Difference between revisions of "Proxy pass (Reverse proxy)"

From wikieduonline
Jump to navigation Jump to search
Line 19: Line 19:
  
  
 +
== Advanced example ==
 +
<pre>
 +
server {
 +
    listen 80;
 +
    server_name www.example.com;
 +
    location / {
 +
        proxy_set_header X-Forwarded-Host $host;
 +
        proxy_set_header X-Forwarded-Server $host;
 +
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 +
        proxy_pass http://localhost:8090;
 +
    }
 +
}
 +
</pre>
  
 
== Miscelaneous ==
 
== Miscelaneous ==

Revision as of 10:57, 3 March 2021

proxy_pass directive in used in Nginx for Reverse Proxy configurations.

https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
location /some/path/ {
   proxy_pass http://www.example.com/link/;
}


Basic example

 server {
    listen 8356;

    location / {
        proxy_pass http://www.example.com:80/
    }
 }


Advanced example

server {
    listen 80;
    server_name www.example.com;
    location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://localhost:8090;
    }
}

Miscelaneous

proxy_http_version 1.0 | 1.1; [1] Default, version 1.0 is used. Version 1.1 is recommended for use with keepalive connections and NTLM authentication.


proxy_set_header

Related directives


See also

  • http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version
  • Advertising: