Commit 965482b6 authored by spenibus's avatar spenibus

fixed misunderstanding regarding staticOrigin, now applied at request level

parent 3ef5382c
......@@ -38,7 +38,7 @@ Preferences
Available in about:addons.
- `enabledAtStartup` : Enables this addon on startup
- `staticOrigin` : Force the value of `access-control-allow-origin`
- `staticOrigin` : Forces the value of the `Origin` header
FAQ
......
......@@ -124,6 +124,16 @@ let spenibus_corsEverywhere = {
// store transaction
spenibus_corsEverywhere.transactions[request.requestId] = transaction;
// force origin based on prefs
if(bg.prefs.staticOrigin) {
transaction.requestHeaders['origin'].value = bg.prefs.staticOrigin;
}
// apply modifications
return {
requestHeaders : transaction.request.requestHeaders
};
}
......@@ -168,19 +178,12 @@ let spenibus_corsEverywhere = {
transaction.responseHeaders[name] = header;
}
// set "access-control-allow-origin"
// use static origin if set in prefs
if(bg.prefs.staticOrigin) {
transaction.responseHeaders['access-control-allow-origin'].value = bg.prefs.staticOrigin;
}
// default: prioritize "origin" else "*"
else {
transaction.responseHeaders['access-control-allow-origin'].value =
transaction.requestHeaders['origin']
&& transaction.requestHeaders['origin'].value !== null
? transaction.requestHeaders['origin'].value
: '*';
}
// set "access-control-allow-origin", prioritize "origin" else "*"
transaction.responseHeaders['access-control-allow-origin'].value =
transaction.requestHeaders['origin']
&& transaction.requestHeaders['origin'].value !== null
? transaction.requestHeaders['origin'].value
: '*';
// set "access-control-allow-methods"
if(
......
......@@ -2,7 +2,7 @@
"manifest_version" : 2
,"name" : "CORS Everywhere"
,"version" : "18.3.8.2031"
,"version" : "18.3.8.2053"
,"author" : "spenibus"
,"description" : "Bypass CORS restrictions by altering http responses."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment