Nginx proxy cache (proxy_pass $request_uri;)
- by imastar
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"