Questions tagged [reverse-proxy]

A reverse proxy server usually refers to an HTTP accelerator or load-balancer which proxies requests on behalf of the actual clients to one or more backend HTTP servers. Make sure your question is programming-related, and not about setup/configuration. Only programming-related questions are on-topic on stackoverflow.

reverse-proxy
Filter by
Sorted by
Tagged with
1936 votes
21 answers
610k views

What's the difference between a proxy server and a reverse proxy server? [closed]

What is the difference between a proxy server and a reverse proxy server?
user avatar
225 votes
12 answers
265k views

Proxy with express.js

To avoid same-domain AJAX issues, I want my node.js web server to forward all requests from URL /api/BLABLA to another server, for example other_domain.com:3000/BLABLA, and return to user the same ...
user124114's user avatar
  • 8,397
224 votes
11 answers
385k views

Nginx reverse proxy causing 504 Gateway Timeout

I am using Nginx as a reverse proxy that takes requests then does a proxy_pass to get the actual web application from the upstream server running on port 8001. If I go to mywebsite.example or do a ...
Dave Roma's user avatar
  • 2,579
172 votes
7 answers
74k views

API gateway vs. reverse proxy

In order to deal with the microservice architecture, it's often used alongside a Reverse Proxy (such as nginx or apache httpd) and for cross cutting concerns implementation API gateway pattern is ...
user1459144's user avatar
  • 2,927
158 votes
8 answers
259k views

Error during SSL Handshake with remote server

I have Apache2 (listening on 443) and a web app running on Tomcat7 (listening on 8443) on Ubuntu. I set apache2 as reverse proxy so that I access the web app through port 443 instead of 8443. Besides,...
user2791481's user avatar
  • 1,681
115 votes
4 answers
169k views

nginx - read custom header from upstream server

I am using nginx as a reverse proxy and trying to read a custom header from the response of an upstream server (Apache) without success. The Apache response is the following: HTTP/1.0 200 OK Date: Fri,...
luis's user avatar
  • 1,899
96 votes
3 answers
147k views

How to serve all existing static files directly with NGINX, but proxy the rest to a backend server.

location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; if (-f $request_filename) { ...
fmalina's user avatar
  • 6,220
76 votes
2 answers
193k views

How to enable CORS in Nginx proxy server?

As my title, here is the config file located in conf.d/api-server.conf server { listen 80; server_name api.localhost; location / { add_header 'Access-Control-Allow-Origin' 'http://api....
qwang07's user avatar
  • 1,186
67 votes
3 answers
119k views

Apache reverse proxy with basic authentication

Trying to configure my reverse proxy with basic authentication before forward the traffic to my back end server. Can any one give me a solution. Example here: User(internet) -> reverse proxy / ...
Vincent P's user avatar
  • 801
55 votes
4 answers
50k views

How to redirect on the same port from http to https with nginx reverse proxy

I use reverse proxy with Nginx and I want to force the request into HTTPS, so if a user wants to access the url with http, he will be automatically redirected to HTTPS. I'm also using a non-standard ...
rbinsztock's user avatar
  • 3,105
53 votes
1 answer
51k views

Difference between X-Forwarded-For and X-Real-IP headers

I'm using Nginx as a reverse proxy. What is the difference between these headers: proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; In some ...
lonix's user avatar
  • 16.6k
49 votes
2 answers
98k views

How to record reverse proxy upstream server serving request in Nginx log?

We use Nginx as a reverse proxy with this setup: upstream frontends { server 127.0.0.1:8000; server 127.0.0.1:8001; server 127.0.0.1:8002; [...] } server { ...
Pol's user avatar
  • 3,958
49 votes
2 answers
104k views

Nginx: when to use proxy_set_header Host $host vs $proxy_host

I've been reading up on reverse proxying and am wondering when proxy_set_header Host $host is appropriate over proxy_set_header Host $proxy_host. I did some research and in this article it says that ...
Alex's user avatar
  • 3,611
48 votes
7 answers
48k views

How do you handle CORS in an electron app?

I'm building an electron app and need to call APIs where the API provider has not enabled CORS. The typically proposed solution is to use a reverse proxy which is trivial to do when running locally ...
Shagymoe's user avatar
  • 1,396
44 votes
4 answers
41k views

HAProxy + WebSocket Disconnection

I am using HAProxy to send requests, on a subdomain, to a node.js app. I am unable to get WebSockets to work. So far I have only been able to get the client to establish a WebSocket connection but ...
Ross's user avatar
  • 14.4k
44 votes
2 answers
108k views

What does the Resolver param in nginx do?

I am using nginx as a reverse_proxy server with ELB. I am looking for explanation regarding the resolver value I set in the nginx.conf file. My nginx.conf: http { ... resolver x.x.x.x valid=...
guyyug's user avatar
  • 997
44 votes
3 answers
10k views

Advantages of a reverse proxy in front of Node.JS

What are the advantages of having nginx or another web-server running as a reverse-proxy in front of the Node.JS? What does it provide? (This question is intended for matters concerning web-apps, not ...
Phil's user avatar
  • 14.2k
44 votes
6 answers
40k views

How to configure nginx X-Forwarded-Port to be the originally request port

I am using nginx in a standard reverse proxy scenario, to pass all requests to /auth to another host, however I'm trying to use non-standard ports. My end goal is to have the X-Forwarded-Port header ...
Andrew Stubbs's user avatar
43 votes
4 answers
35k views

nginx proxy_pass to a linked docker container

I have two docker containers with nginx. container1 is linked to container2. Docker then adds an entry to /etc/hosts which I entered into the nginx configuration like so: server { location ~ ^/...
Tim's user avatar
  • 1,398
43 votes
2 answers
123k views

How to pass all Python's traffics through a http proxy?

I want to pass all Python's traffics through a http proxy server, I checked urlib2 and requests packages for instance, they can be configured to use proxies but how could I use something like a system-...
Hassan Abedi's user avatar
43 votes
3 answers
36k views

What's the de facto standard for a Reverse Proxy to tell the backend SSL is used?

I have a reverse proxy that does HTTPS on the outside, but HTTP on the inside. This means that by default in-app URLs will have HTTP as the scheme, as this is the way it's being contacted. How can ...
Chris Wesseling's user avatar
42 votes
4 answers
44k views

Nginx reverse proxy to Heroku fails SSL handshake

I'm unfortunately not much of a system administrator and have come upon a problem that has me banging my head against the wall. The short story is that I'm running Nginx on EC2 (Ubuntu 14.04.4 LTS) ...
Bart's user avatar
  • 1,381
41 votes
4 answers
123k views

Nginx does redirect, not proxy

I want to set up Nginx as a reverse proxy for a https service, because we have a special usecase where we need to "un-https" a connection: http://nginx_server:8080/myserver ==> https://...
mitchkman's user avatar
  • 6,480
40 votes
8 answers
66k views

Spring Boot with embedded Tomcat behind Apache proxy

We have a Spring Boot (Spring MVC) app with embedded Tomcat on a dedicated appserver behind an Apache SSL proxy. The SSL port on the proxy server is 4433, forwarding to port 8080 on the appserver. So ...
Rop's user avatar
  • 3,409
39 votes
2 answers
27k views

When using proxy_pass, can /etc/hosts be used to resolve domain names instead of "resolver"?

Can /etc/hosts be used instead of resolver when using proxy_pass? I need to perform a proxy_pass to the same nginx machine. Is there a way to resolve the domains using the machine's /etc/hosts file ...
Ianthe the Duke of Nukem's user avatar
37 votes
2 answers
67k views

NGINX - Reverse proxy multiple API on different ports

I have the following API(s): localhost:300/api/customers/ localhost:400/api/customers/:id/billing localhost:500/api/orders I'd like to use NGINX to have them all run under the following location: ...
Proximo's user avatar
  • 6,423
36 votes
2 answers
58k views

Nginx reverse proxy error:14077438:SSL SSL_do_handshake() failed

So i am using following settings to create one reverse proxy for site as below. server { listen 80; server_name mysite.com; access_log /var/log/nginx/access.log; error_log /...
Muaaz Rafi's user avatar
  • 1,489
35 votes
7 answers
21k views

Can nginx be used as a reverse proxy for a backend websocket server?

We're working on a Ruby on Rails app that needs to take advantage of html5 websockets. At the moment, we have two separate "servers" so to speak: our main app running on nginx+passenger, and a ...
John Reilly's user avatar
  • 1,790
34 votes
9 answers
57k views

Why does Jenkins complain that my reverse proxy setup is broken?

I have no idea why after Jenkins is updated to version 1.591 (Ubuntu Server 12.04), the originally correctly set up reverse proxy now becomes broken. My current setting is exactly the same as said in ...
Kevin's user avatar
  • 433
34 votes
3 answers
113k views

How to use NGINX as forward proxy for any requested location?

I am trying to configure NGINX as a forward proxy to replace Fiddler which we are using as a forward proxy. The feature of Fiddler that we use allows us to proxy ALL incoming request to a 8888 port. ...
Arman Bimatov's user avatar
34 votes
5 answers
18k views

How to log real client ip in rails log when behind proxy like nginx

Problem I have a rails 3.2.15 with rack 1.4.5 setup on two servers. First server is a nginx proxy serving static assets. Second server is a unicorn serving the rails app. In Rails production.log I ...
cbliard's user avatar
  • 7,181
31 votes
6 answers
12k views

Cognito - Client is not enabled for OAuth2.0 flows

I've successfully set up an AWS Cognito environment that runs on Localhost following this tutorial. For the next step, I published the app to my external web server. I confirmed that the Cognito ...
objectively C's user avatar
31 votes
5 answers
44k views

Avoid nginx decoding query parameters on proxy_pass (equivalent to AllowEncodedSlashes NoDecode)

I use nginx as a load balencer in front of several tomcats. In my incoming requests, I have encoded query parameters. But when the request arrives to tomcat, parameters are decoded : incoming request ...
Jean-Philippe Caruana's user avatar
31 votes
1 answer
30k views

The simplest possible reverse proxy [closed]

I'm looking for a way to simply set up a proxy locally that connects to a remote site. I don't want to install anything in the system proper. If I could call it with a single command-line call rather ...
clacke's user avatar
  • 7,838
29 votes
1 answer
23k views

nginx proxy pass Node, SSL?

my nginx server is actually proxying my node backend (which listens on port 3000) with a simple: location /api/ { proxy_pass http://upstream_1; } Where upstream_1 is my node cluster defined in nginx....
spacenick's user avatar
  • 1,181
28 votes
5 answers
52k views

nginx as cache proxy not caching anything

I'm trying to cache static content which are basically inside the paths below in virtual server configuration. For some reason files are not being cached. I see several folders and files inside the ...
Bruno Faria's user avatar
  • 5,222
27 votes
8 answers
27k views

Is there any way to configure nginx (or other quick reverse proxy) dynamically?

Suppose we have several identical nodes which are the application servers of some n-tier service. And suppose we use Apache ZooKeeper to keep all the config's of our distributed application. Plus we ...
Dima's user avatar
  • 547
26 votes
4 answers
22k views

How to read response body of ReverseProxy

package main import ( "net/http" "net/http/httputil" "net/url" ) func main() { target := &url.URL{Scheme: "http", Host: "www.google.com"} proxy := httputil....
fannheyward's user avatar
  • 18.9k
26 votes
4 answers
58k views

Intercepting backend 301/302 redirects (proxy_pass) and rewriting to another location block possible?

We have a couple of backends sitting behind our nginx front ends. Is it possible to intercept 301 / 302 redirects sent by these backends and have nginx handle them? We were thinging something alone ...
anonymous-one's user avatar
26 votes
1 answer
22k views

nginx 'invalid number of arguments in "map" directive'

I'm trying to reverse-proxy a websocket, which I've done with nginx before with no issue. Weirdly, I can't seem to re-create my prior success with something so simple. I've been over and over the ...
Ryan Kennedy's user avatar
  • 3,375
26 votes
1 answer
70k views

nginx reverse proxy to backend running on localhost

EDIT: It turns out that the my setup below actually works. Previously, I was getting redirections to port 36000 but it was due to some configuration settings on my backend application that was causing ...
yanhan's user avatar
  • 3,517
25 votes
10 answers
45k views

Laravel routes behind reverse proxy

Ok, so for development purposes, we have a dedicated web server. It's not currently connected directly to the internet, so I've setup an apache reverse proxy on another server, which forwards to the ...
Phil Cross's user avatar
  • 9,187
25 votes
5 answers
29k views

How do I use Rack::Proxy within Rails to proxy requests to a specific path to another app

I found this great blog post on how to use Rack::Proxy as a separate proxy app. The article explains how he uses Rack::Proxy to proxy requests to http://localhost:3000 to an app on port 3001 and ...
John's user avatar
  • 9,378
25 votes
2 answers
10k views

nginx 1.2.0 - socket.io - HTTP/1.1 - Proxy websocket connections

i would like to replace my node-http-proxy module with nginx proxy_pass module. Is it possible with new released nginx version, as i have read, that it supports HTTP/1.1 out of the box. I saw some ...
ayk's user avatar
  • 1,340
25 votes
3 answers
122k views

Nginx proxy_pass to https

we have: Ubuntu 16.04 nginx 1.10.3 i am new to nginx and need help on proxy_pass to https. We have clients in internet they call a url for example. https://testapp.mobios.example.com i want to pass ...
mobios's user avatar
  • 383
25 votes
2 answers
37k views

Code to get a Java servlet to act as a proxy?

I have two Java web applications that have a single servlet that gets mapped to a specific URL: red.war/ WEB-INF/classes com.me.myorg.red.RedServlet (maps to http://red.example.com/...
IAmYourFaja's user avatar
  • 56.3k
24 votes
4 answers
38k views

proxy_pass isn't working when SELinux is enabled, why?

I'm having an application listening on port 8081 and Nginx running on port 8080. The proxy pass statement looks like: $ cat /var/etc/opt/lj/output/services/abc.servicemanager.conf location /api/abc....
Vijay Shankar Kalyanaraman's user avatar
24 votes
4 answers
52k views

How to properly set JSESSIONID cookie path behind reverse proxy

My web app is running in Tomcat at http://localhost:8080/example.com/ but it is being reverse proxied from Apache that is serving up http://example.com/ on port 80. My web app looks at the request....
Stephen Ostermiller's user avatar
24 votes
1 answer
36k views

Nested locations in nginx

Hi I'm trying to get the following to work! I'm basically trying to allow the following URLs to be passed to the proxy_pass directive by either of these two URLS: http://example.com/admin/1 or http:/...
geekscrap's user avatar
  • 1,005
24 votes
2 answers
16k views

What does HTTP/2 mean for a reverse proxy server?

How HTTP/2 affects the implementation of a proxy server? Especially, for example, when a client sends an HTTP/2 request to a content server that only supports HTTP/1.x, should the proxy server ...
lifang's user avatar
  • 1,615

1
2 3 4 5
104