correct usage of proxy_set_header?

eN_Joy nginx-forum at
Thu Feb 13 22:34:44 UTC 2014

Hello all!
I have configured a location that acts list a transparent proxying cache:


        location /get
            set $hostx "";
            set $addrs "";
            if ( $uri ~ "^/get/http./+([^/]+)/(.+)$") {
                set $hostx $1;
                set $addrs $2;
            proxy_set_header Referer " ";
            proxy_pass http://$hostx/$addrs;
            proxy_redirect off;
            access_log /var/log/nginx/get_access.log;

Basically when i browser to: 

it'll get:

The code indeed works that way, except that the directive `proxy_set_header
referer " "` is ignored. No matter what value I supply there (in the code
above, empty), my get_access.log will always show the referer being the
original refering page? 

What was wrong in my config?

Posted at Nginx Forum:,247536,247536#msg-247536

More information about the nginx mailing list