Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have configured a squid 3.1 proxy server.
Everything works great except for the X-Requested-With header.
I can't manage to figure out how to pass that header to the site I'm attempting to open via the proxy.

This is my current configuration:

request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Cookie allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access User-Agent allow all
request_header_access All deny all #remove all other headers


# delete "x-forwarder-for.." headers
forwarded_for delete
request_header_access Via deny all
request_header_access X-Forwarded-For deny all

I tried to add this line request_header_access X-Requested-With allow all to the configuration but apparently X-Requested-With is an unknown header name... Apparently I'm missing something?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

request_header_access requires --enable-http-violations to be specified when you build squid. Check its presence.

Update

Also the documentation states:

By default, all headers are allowed (no anonymizing is performed).

This means that if a header is not listed anyhow then squid should pass it transparently.

Update

If you have some anonymizing set up then you should put all 'allow' rules before 'All deny All' rule

share|improve this answer
    
@tftd Does the client actually send this header? –  Serge Sep 22 '12 at 21:58
    
Yes the client sends it in ajax requests via XMLHttpRequest. You can't enable http-violations in 3.1 because it's endabled by default. I've updated my question (there was a missing line). If I remove the line request_header_access All deny all it works fine, but then the proxy becomes transparent and that's not what I need. –  tftd Sep 23 '12 at 8:29
    
The configuration I've posted in the question shows all of the rules are before request_header_access All deny all :) –  tftd Sep 23 '12 at 8:58
    
@tftd But it does not list your 'X-Requested-With' –  Serge Sep 23 '12 at 11:14
    
If you read the bottom of the question you'll see I have stated squid returns an error unknown header name when I add request_header_access X-Requested-With allow all. –  tftd Sep 23 '12 at 12:07
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.