Skip to content

Only set X-Forwarded-Proto when header not set - #406

Open
espadrine wants to merge 1 commit into
haiwen:masterfrom
espadrine:x-fwd-proto
Open

Only set X-Forwarded-Proto when header not set#406
espadrine wants to merge 1 commit into
haiwen:masterfrom
espadrine:x-fwd-proto

Conversation

@espadrine

Copy link
Copy Markdown

When the seafile docker container
is behind a proxy that does the TLS termination,
such that the seafile docker sees HTTP only,
then, it receives requests
where the following headers are set in the following way:

X-Forwarded-Proto: https
X-Forwarded-Ssl: on

Because the default NGINX template has this directive:

proxy_set_header X-Forwarded-Proto $scheme

the request gets transmitted to gunicorn with the following, contradictory values:

X-Forwarded-Proto: http
X-Forwarded-Ssl: on

Thus Seafile rejects the requests
with a "Contradictory scheme headers" error.

We instead change the header only when it is not set.

Fixes #226.

When the seafile docker container
is behind a proxy that does the TLS termination,
such that the seafile docker sees HTTP only,
then, it receives requests
where the following headers are set in the following way:

    X-Forwarded-Proto: https
    X-Forwarded-Ssl: on

Because the default NGINX template has this directive:

    proxy_set_header X-Forwarded-Proto $scheme

the request gets transmitted to gunicorn with the following,
contradictory values:

    X-Forwarded-Proto: http
    X-Forwarded-Ssl: on

Thus Seafile rejects the requests
with a "Contradictory scheme headers" error.

We instead change the header only when it is not set.

Fixes haiwen#226.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Contradictory scheme headers" when passing both X-Forwarded-Proto and X-Forwarded-Protocol

2 participants