Possible to normalize headers in nginx?

Victor Iggy lists at ruby-forum.com
Sat Aug 8 06:01:01 MSD 2009


I have the following set to normalize Accept-Encoding headers for squid
which sits down stream.

However, I am getting an issue with the following error...

[emerg]: "proxy_set_header" directive is not allowed here in
/opt/extra/nginx/conf/nginx-master.conf:51
configuration file /opt/extra/nginx/conf/nginx-master.conf test failed


Am I out of luck when it comes to normalizing http headers with nginx?


    server {
        listen       3000;
        server_name  localhost;

        location / {
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header  X-Forwarded-For
$proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;

            if ($http_accept_encoding ~ deflate) {
                proxy_set_header Accept-Encoding deflate;
            }
            if ($http_accept_encoding ~ gzip) {
                proxy_set_header Accept-Encoding gzip;
            }
            if ($request_uri ~
"\.(jpeg|jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|ico|swf|mp4|flv|mov|dmg|mkv)")
{
                proxy_set_header Accept-Encoding "";
            }

            proxy_pass http://72.11.142.91:7999/;
            break;
        }
    }
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list