Add local file url to allowed domains Firefox : about:config - firefox

I am creating a screen sharing addon in Firefox and need to use : media.getusermedia.screensharing" feature.
But since I am working locally using AddOn SDK, my url of opened html file is : resource://jid1-q3wuqdulcvnnrq-at-jetpack/toolbar_button/data/index.html
Now, on this link I get an error :
In about:config, please enable media.getusermedia.screensharing.enabled
and add this site's domain name to media.getusermedia.screensharing.allowed_domains in about:config
Also It requires an https connection.
While the same WebRTC works fine in Chrome extension.
Can someone please guide on how to add local file url to allowed domains? or to use getusermedia for local development.

A search on mxr for screensharing:
http://mxr.mozilla.org/mozilla-release/search?string=screensharing
which led to this whitelist:
http://mxr.mozilla.org/mozilla-release/source/dom/media/MediaManager.cpp#151
So then i checked domains already in this pref, they were: webex.com,*.webex.com,collaborate.com,*.collaborate.com
so when i did this: Services.io.newURI('http://www.webex.com', null, null) i got this:
So it looks like whatever is in host is what we want in this pref. So i tried newURI of file uri:
Services.io.newURI('file:///C:/Users/Vayeate/Documents/GitHub/Profilist/bullet_aurora.png',null,null)
it dumps this:
so im thinking in the the pref add this:
,,
which is a blank space, which is what it looks like it is for file uris
so mine would look like: webex.com,*.webex.com,collaborate.com,,*.collaborate.com
or can even trying just an asterik so like:
webex.com,*.webex.com,collaborate.com,*.collaborate.com,*

Related

Full Media URL in Strapi

The Strapi API responds the media URLs as something like "url:'/uploads/thumbnail.png'".
I would like to get the complete URL that links to my file as value for "url". For example: "url:'https://example.org/uploads/thumbnail.png'"
The documentation also shows the full URL as response. How can I achieve this?
The full URLs come from using an upload provider such as AWS-S3 or Cloudinary. The local provider doesn't support full URLs at the moment.
There are some potentials reasons why you shouldn’t store a full URL, and respond with a full URL. I won’t dive into those reasons.
I suggest creating the entire request/response, or creating a middleware component to intercept the response.
Then you can modify the original url value with the site’s URL. Looping through the results with something like:
const serverHost = strapi.config.get('server.host', 'defaultValueIfUndefined');
url = serverHost + url;
See the following docs for more details:
https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations.html
https://docs.strapi.io/developer-docs/latest/development/backend-customization/middlewares.html#implementation

proxy.pac - exception for images

I'm a web developer and I use squid as a proxy, which I entered in firefox as the proxy server.
So when I enter http://www.example.com in firefox, I see the site on my local machine, by having configured squid accordingly.
Now problem is, that some of our customers have GBs of images, and it's a pain to load them all on my machine. So basically I want to use my offline webpage, but loading the images from the live server, so I don't have a broken site without images.
In order to do this I've tried to create a proxy.pac and configured it this way:
function FindProxyForURL(url, host) {
if (shExpMatch(url, "*.jpg")) {
return "DIRECT";
} else {
return "PROXY 192.168.178.31:3128; DIRECT";
}
}
Unfortunately it doesn't really work. What am I doing wrong, and how can I achieve my goal?
According to the Mozilla document on PAC files:
The path and query components of https:// URLs are stripped. In Chrome, you can disable this by setting PacHttpsUrlStrippingEnabled to false, in Firefox the preference is network.proxy.autoconfig_url.include_path.
What this means is when you enter a url such as https://www.example.com/image.jpg, what gets passed to the PAC script is the url https://www.example.com. As a result, you're never going to enter the first condition of your if statement.
In Firefox, you can change this by going to the about:config page and setting network.proxy.autoconfig_url.include_path to true.

Allow URLs with Dashes on azure websites

I am trying to make an SEO friendly link for a downloads page
using codeigniter hosted on Azure Websites, now this is working:
www.example.com/downloads/viewfile/34
now when i generated this link :
www.example.com/downloads/viewfile/my-nice-file-name-34
the Url rewrite works great locally on a WAMP server, but when deployed to the remote (Azure Webites IIS ?) it gives the error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I believe that the cause is: dash symbols are not allowed on IIS but is there a way arround ?
After all, i found out that its not the dash symbols that are causing the problem, but the words in the url itself
like yesterday i had www.example.com/downloads/viewfile/example-file-34
to some reason, having your domain-name in the url segments makes that error apear, so i simply replaced "mydomain" into nothing before generating the Url segment
$fileName = str_replace('mydomain','',$fileName);
return url_title($fileName.$fileId);
Now the same link above is www.example.com/downloads/viewfile/file-34 and its working fine.
i also noticed that same behavior is experienced when using some words like : ajax, json.
I hope this would be helful to somone.
In your routes.php file
Find
$route['translate_uri_dashes'] = FALSE;
Replace with
$route['translate_uri_dashes'] = TRUE;
You may need to look also into
URI Routing Codeigniter 3
http://www.codeigniter.com/user_guide/general/routing.html
Codeigniter 2 URI Routing
http://www.codeigniter.com/userguide2/general/routing.html

Using a local proxy auto configuration (.pac) file for proxy settings from a chrome extension

I want to modify the proxy settings of chrome using an extension.
I want it to use a local .pac file which is present in my extension's root folder.
I tried following ways to refer this pac file:
settings.pacScript.url = "proxyFile.pac";
settings.pacScript.url = "chrome-extension://adcccdddeeefffggghhhiiijjjkkklll/proxyFile.pac";
These two methods do not work.
I tried using "chrome://net-internals" to inspect what is happening and found the following(there was no file not found error or pac javascript error):
PROXY_CONFIG_CHANGED
--> old_config =
Use DIRECT connections.
--> new_config =
Use DIRECT connections.
Whereas the following two approaches work:
settings.pacScript.url = "C:\\Users\\username\\Desktop\\myChromeExtension\\proxyFile.pac";
settings.pacScript.url = "http://www.example.com/proxyFile.pac";
Now since I want to refer to the local file in my extension, I cannot use http url.For using file url, how do I know the url of my extension's root folder?
Looking for help on this.
Thanks
In a chrome extension, you can get a URL for a file inside your extension with chrome.extension.getURL. This will return a chrome-extension:// URL.
In your case, you want:
settings.pacScript.url = chrome.extension.getURL("proxyFile.pac");

How can I rewrite URLs in the Zeus web server for Mobile useragent?

I need to redirect anyone with a mobile user agent to a file called mobile.php.
My web hosting provider, Net Registry uses the Zeus web server.
Here's the script I've written from my research
RULE_1_START:
# get the document root
map path into SCRATCH:DOCROOT from /
match IN:User-Agent into $ with iPad|iPod|iPhone|Android|s+Mobile
if matched then
set OUT:Location = /mobile.php
endif
RULE_1_END:
I used the instructions on my host's site.
I pasted that into their console and it has worked to do redirects. Net registry have some odd console thing that you submit and it takes 10 minutes to update the zeus server config (annoying as hell).
Anyway my issue is that it redirects me to the wrong location:
So if you visit the site, with a user agent string that contains ipad|ipod|android|\s+mobile then you will trigger it ()
It takes me here:
http://example.com.au/mobile.php,%20catalog/index.php
I can't work out how to fix that, or why that happens because at the moment this file exists:
http://example.com.au/mobile.php
as does this one:
http://example.com.au/index.php. Contents of this file are:
<?php header("Location: catalog/index.php");
Any ideas on how I can make this work more like an apache .htaccess url Rewrite?
the official Zeus documentation
Fixed it by changing
set OUT:Location = /mobile.php
to
set URL = /mobile.php
From the manual...
Using Request Rewrite Scripts
To use the request rewriting functionality, create a script in the Zeus Request
Rewrite Scripting Language. The script contains instructions telling the
Virtual Server how to change the URL or headers of requests that match specified criteria.
The Virtual Server compiles the script, and (if the rewrite functionality is
enabled) uses it every time it receives a request. It runs the commands in the
script, changing the URL if it matches the specified criteria. Once the script is
finished, the Virtual Server continues processing the resulting URL.Zeus Web Server 4.3 User Guide
142 Configuring URL Handling
When changing the URL, the rewrite functionality can only change the local
part of it, that is, the part of the URL after the host name. For example, if a
user requests http://www.myhost.com/sales/uk.html, the rewrite
functionality can only make changes to /sales/uk.html. This means that
you cannot use the rewrite functionality to change the request to refer to a
file on another Virtual Server.
For example, the following script illustrates how to change requests for any
HTML files in the /sales directory so that the user receives them from the
/newsales directory instead:
match URL into $ with ^/sales/(.).html
if matched set URL=/newsales/$1.html
The rewrite functionality can also change the HTTP headers that were received
with a request, and create new HTTP headers to be returned to the user. For
example, the following script changes the HTTP host header, so that a request
for www.mysite.com/subserver is redirected to the Subserver
www.subserver.mysite.com:
match URL into $ with ^/([^/]+)/(.)$
if matched then
set IN:Host = www.$1.mysite.com
set URL = /$2
endif

Resources