N00b: Forwarding the full request to upstream server

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

N00b: Forwarding the full request to upstream server

Joel Parker
I have a situation where I receive a request like:

http://device.healthcheck.com/ready

I want this to be sent to a server upstream but keep the full request intact. For example:

server {
                resolver 8.8.8.8;
                listen 80;

        location / {
                        // send this too 192.168.10.34
                        proxy_pass $host:$server_port$uri$is_args$args;
                }
}

I know this is probably easy to do but I am not sure how to accomplish this.

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: N00b: Forwarding the full request to upstream server

Friscia, Michael

I’m interested in this answer as well but will offer what I’ve done so far.

 

In your example, the only thing I’ve added are these three lines in the location block:

proxy_cache_valid 200 1y;

proxy_cache_bypass 1;

proxy_no_cache 1;

 

But I am not sure I am doing this correctly because I am running into a situation where I don’t think the original request is staying intact.

 

Other settings that are common to both cache and bypass (also not sure these are all correct for bypassing):

 

proxy_cache_valid any 3m;

proxy_cache_revalidate on;

proxy_cache_use_stale error timeout updating invalid_header http_500 http_502 http_503 http_504;

proxy_cache_background_update on;

proxy_cache_lock on;

proxy_cache_methods GET HEAD;

proxy_cache_key "$scheme$host$request_uri";

 

proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;

 

proxy_hide_header X-Accel-Expires;

proxy_hide_header Expires;

proxy_hide_header Cache-Control;

proxy_hide_header Set-Cookie;

proxy_hide_header Pragma;

proxy_hide_header Server;

proxy_hide_header Request-Context;

proxy_hide_header X-Powered-By;

proxy_hide_header X-AspNet-Version;

proxy_hide_header X-AspNetMvc-Version;

 

proxy_set_header X-Forwarded-Server $hostname;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Accept-Encoding identity;

 

server_tokens off;

 

___________________________________________

Michael Friscia

Office of Communications

Yale School of Medicine

(203) 737-7932 - office

(203) 931-5381 - mobile

http://web.yale.edu

 

 

From: nginx <[hidden email]> on behalf of Joel Parker <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Sunday, February 4, 2018 at 8:26 PM
To: "[hidden email]" <[hidden email]>
Subject: N00b: Forwarding the full request to upstream server

 

I have a situation where I receive a request like:

http://device.healthcheck.com/ready

I want this to be sent to a server upstream but keep the full request intact. For example:

server {

                resolver 8.8.8.8;
                listen 80;

        location / {

                        // send this too 192.168.10.34

                        proxy_pass $host:$server_port$uri$is_args$args;
                }
}

I know this is probably easy to do but I am not sure how to accomplish this.


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: N00b: Forwarding the full request to upstream server

ayman