Questions tagged [reverse-proxy]

A reverse proxy is a type of proxy server that fetches resources from a specific defined set of servers for a client. It is used in cases when there is an advantage to not exposing the web server with the content directly whether it be for security reasons or because of a lack of available public IP addresses.

A reverse proxy is a type of server. Unlike a traditional "forward proxy" server, a reverse proxy fetches resources from a specific defined set of servers for a client. The Apache HTTPD server's mod_proxy module is a popular example of software that can be used as a reverse proxy.

A reverse proxy can be used in cases when there is an advantage to not exposing the server with the content directly to the Internet, whether it be for security reasons or because of a lack of available public IP addresses.

3190 questions
16
votes
3 answers

Is it possible to replace content on every page passed through a proxy similar to how mod_rewrite is used for URLs?

Is it possible to replace content on every page passed through a proxy similar to how mod_rewrite is used for URLs? The documentation on substitute is not clear. I have some pages I am reverse proxying that have absolute paths. This breaks the site.…
ZZ9
  • 888
  • 3
  • 16
  • 47
16
votes
1 answer

can't get mod_proxy to correctly forward encoded slash (/) characters (%2f)

I have a virtual host set up to redirect ntung-gitblit.localhost --> myserver:1279. However, it's not working with forward encoded slashes (%2f). The URL I'm trying to access is, http://ntung-gitblit.localhost/ABC%2fXYZ Without AllowEncodedSlashes,…
gatoatigrado
  • 469
  • 1
  • 3
  • 8
15
votes
2 answers

Use Nginx as Reverse Proxy for multiple servers

I am trying to configure nginx as a reverse proxy for multiple servers on my LAN. They should go out on my WAN with different subdomains. My configuration looks like this: @ReverseProxy:/etc/nginx/sites-enabled$ cat reverseproxy server { …
15
votes
2 answers

nginx reverse ssl proxy with multiple subdomains

I'm trying to locate a high level configuration example for my current situation. We have a wildcard SSL certificate for multiple subdomains which are on several internal IIS servers. site1.example.com (X.X.X.194) ->…
BrianM
  • 185
  • 1
  • 2
  • 8
15
votes
5 answers

How can I stop nginx from retrying PUT or POST requests on upstream server timeout?

We are using nginx to load balance requests to our application. We have found that nginx switches to a different upstream server when requests time out (good). However it does this for PUT and POST requests which can cause undesirable results (data…
David Tinker
  • 589
  • 1
  • 8
  • 18
15
votes
4 answers

Controlling Nginx proxy target using a cookie?

I'm trying to convert a reverse proxy using an interesting Apache mod_rewrite setup to use Nginx instead (due to external concerns we are moving from Apache to Nginx, and most everything works fine except this part). My original setup was to read an…
Guss
  • 2,670
  • 5
  • 34
  • 59
14
votes
1 answer

How to configure nginx so it works with Express?

I'm trying to configure nginx so it proxy_pass requests to my node apps. Question on StackOverflow got many upvotes: https://stackoverflow.com/questions/5009324/node-js-nginx-and-now and I'm using config from there. (but since question is about…
Mars Robertson
  • 243
  • 1
  • 2
  • 6
14
votes
3 answers

In nginx reverse proxy, how to set the secure flag for cookies?

I'm using nginx as a reverse proxy to serve a https-only site. So I want the cookies for this site flagged as secure. But the backend server is an http one so it won't set the secure flag to its cookies. How can I modify the Set-Cookie header in…
Tianyi Cui
  • 265
  • 1
  • 2
  • 8
14
votes
3 answers

How to reverse proxy with or without trailing slash

I have an Apache web server that needs to reverse proxy a site. So example.com/test/ or example.com/test pull from the same other webserver. I have setup a reverse proxy for the one without the trailing slash like this: ProxyPass /test…
DM.
  • 143
  • 1
  • 1
  • 6
13
votes
1 answer

Single server, nginx as a reverse proxy, multiple domains/websites

I have this nginx config for my website on https where nginx is used as a reverse proxy server: server { listen 80 default_server; listen [::]:80 default_server; server_name my_domain123.com www.my_domain123.com; return 301…
Rakori
  • 239
  • 1
  • 2
  • 5
13
votes
2 answers

When nginx is configured as reverse proxy, can it rewrite the host header to the downstream server like Apache's ProxyPreserveHost?

I can't seem to find the equivalent of Apache's ProxyPreserveHost http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypreservehost option in nginx. This is required to reverse proxy to virtual hosts. What it does is replace the host name the…
Christopher Baus
13
votes
1 answer

How to log original value of $remote_addr when using Real-IP

My environment has user requests passing through a number of systems: [Client] --> [ELB] ---> [nginx] --> [web] (ELB = AWS Elastic Load Balancer) Thanks to this answer, I have nginx determining and passing the correct client IP address to the…
michaelg
  • 250
  • 1
  • 3
  • 9
13
votes
1 answer

How to prevent nginx from reverse proxy specific subdirectories

On Apache you can ProxyPass everything except one or more subdirectories (with "!"). ProxyPass /subdir ! ProxyPass / http://localhost:9999/ What is the Nginx equivalent ? My first guess is obviously not working : location /subdir { …
Falken
  • 1,702
  • 5
  • 18
  • 28
13
votes
2 answers

Varnish versus other reverse proxies

I'm working with an organisation that has deployed Varnish as a caching reverse proxy for all of their web traffic. Their traffic make up is a lot of customer-generated dynamic websites, with the usual collection of static assets hanging off the…
womble
  • 96,255
  • 29
  • 175
  • 230
13
votes
1 answer

nginx stream proxy vs http proxy for ssl termination

I am running an HTTP service and want to put nginx in front for SSL termination. This can be done in two ways; either as a stream proxy stream { server { listen 443 ssl; ssl_certificate /certs/fullchain.pem; …
fredrikekre
  • 233
  • 1
  • 2
  • 6