Nginx proxy cache (proxy_pass $request_uri;)
Posted
by
imastar
on Server Fault
See other posts from Server Fault
or by imastar
Published on 2013-02-05T12:09:38Z
Indexed on
2014/06/13
3:28 UTC
Read the original article
Hit count: 371
I need to create proxy web using nginx. If I access http://myweb.com/http://www.target.com/ the proxy_pass should be http://www.target.com/
Here is my configuration:
location / {
proxy_pass $request_uri;
proxy_cache_methods GET;
proxy_set_header Referer "$request_uri";
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ignore_headers Cache-Control;
proxy_hide_header Pragma;
proxy_hide_header Set-Cookie;
proxy_set_header Cache-Control Public;
proxy_cache cache;
proxy_cache_valid 200 10h;
proxy_cache_valid 301 302 1h;
proxy_cache_valid any 1h;
}
Here is the log error
2013/02/05 12:58:51 [error] 2118#0: *8 invalid URL prefix in "/http://www.target.com/", client: 108.59.8.83, server: myweb.com, request: "HEAD /http://www.target.com/ HTTP/1.1", host: "myweb.com"
© Server Fault or respective owner