Location directive causing a redirect?

W. Andrew Loe III andrew at andrewloe.com
Tue Sep 21 07:49:13 MSD 2010


Using the following configuration, causes a request for
domain.com/blog to 301 to domain.com/blog/ even with debug on error
log I cannot see where this is happening in nginx.

    location ^~ /blog/ {
      rewrite ^/blog(.*)$ $1 break;

      proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header      Host blog.onehub.com;
      proxy_set_header      X-Real-IP $remote_addr;
      proxy_set_header      X-Forwarded-Proto http;

      set $do_not_cache '';
      if ($http_cookie ~*
"comment_author_|wordpress_(?!test_cookie)|wp-postpass_") {
       set $do_not_cache 1;
      }

      proxy_cache_key "$scheme://$host$request_uri $do_not_cache";
      proxy_cache blog;
      proxy_cache_valid  200 302  60m;
      proxy_cache_valid  404      1m;

      proxy_pass http://blog;
    }



More information about the nginx mailing list