N00b: Forwarding the full request to upstream server

Friscia, Michael michael.friscia at yale.edu
Mon Feb 5 01:33:13 UTC 2018

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

From: nginx <nginx-bounces at nginx.org> on behalf of Joel Parker <joel.parker.gm at gmail.com>
Reply-To: "nginx at nginx.org" <nginx at nginx.org>
Date: Sunday, February 4, 2018 at 8:26 PM
To: "nginx at nginx.org" <nginx at nginx.org>
Subject: N00b: Forwarding the full request to upstream server

I have a situation where I receive a request like:
I want this to be sent to a server upstream but keep the full request intact. For example:

server {
                listen 80;

        location / {
                        // send this too
                        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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20180205/f06a9daa/attachment.html>

More information about the nginx mailing list