Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle http headers when behind a well configured proxy #70

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
handle http headers when behind a well configured proxy
Fixes Unidata/thredds#1310

This should work with the following Nginx proxy config:

```
    location /thredds/ {
        proxy_pass http:https://thredds:8080/thredds/;
        proxy_set_header Host $host;  # pass the original public hostname to Thredds
        proxy_set_header X-Forwarded-Proto $scheme;  # pass the original httpS proto to Thredds
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  # pass the original client IP to Thredds
    }
```
  • Loading branch information
tlvu committed Sep 20, 2019
commit 44e76f56061a07ea083b2fd87f82ed406a878864
13 changes: 13 additions & 0 deletions server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--
Handle X-Forwarded-Proto and X-Forwarded-For http header when
behind a well configured proxy.

* X-Forwarded-Proto is to preserve the original proto (httpS)
from the client connecting URL.

* X-Forwarded-For (set by default by the Valve) is to preserve the
original client IP in the logs. Otherwise the nearest proxy IP
will be logged, much less useful for auditing.
-->
<Valve className="org.apache.catalina.valves.RemoteIpValve"
protocolHeader="X-Forwarded-Proto" />

<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
Expand Down