Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1632 Adding header to bypass Cross Domain request in privoxy problem ?

3.0.15
open
nobody
crossdomain (1)
6
2014-03-05
2014-03-05
bourne
No

I am trying to create a browser plugin and using privoxy to bypass cross domain policy in browser which checks for Access-Control-Allow-Origin: * this header in server-response if it is present browser processes the request correctly.

I have a local application running on port 127.0.0.1:5050 and i wish to access this with privoxy and I want privoxy to add that header so that browser can process the request.My version edits the Server: header and should replace it with Access-Control-Allow-origin but ?

Problem:-
User.filter

SERVER-HEADER-FILTER: allow-crossdomain
s|Server: .|Access-Control-Allow-Origin: |

User.Action
{+server-header-filter{allow-crossdomain}}

Not working ?? I have added them to end of these files.
I also tried a simple version by chaning s/Server/Test/g in the server header it is also not getting replaced . Please tell me what's wrong that I am doing ? and what is the correct way to add an header in the reply or edit the Server: header to Access-Control-Allow-Origin.

Discussion

  • Fabian Keil
    Fabian Keil
    2014-03-05

    Your user.action excerpt lacks an URL pattern.

    If you check your test URL with http://config.privoxy.org/show-url-info, you'll probably see that the filter isn't applied.

    You could also enable the debug directives suggested at http://config.privoxy.org/user-manual/contact.html#SUFFCIENT-INFORMATION and check the log.

    Adding an URL pattern should enable the filter.

    There currently isn't a "proper" way to add a server header, so rewriting an existing header is the usual method. You can also append a new header to an existing header by using "\r\n". This is an undocumented "feature", though, and Privoxy itself will treat the two headers as one (changing this is TODO item #112).