-
Notifications
You must be signed in to change notification settings - Fork 187
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
"Contradictory scheme headers" when passing both X-Forwarded-Proto and X-Forwarded-Protocol #226
Comments
I am able to reproduce this.
proxy.conf:
Result when I request the Seafile login form:
However, when I change |
For those sick and tired of being sick and tired: If you use linuxservers SWAG or older letsencrypt server, the issue is slightly more nuanced. The challenge is that Here is my working example:
|
@SkywalkerSpace , could you clarify how and where was this fixed? I'm hitting this issue with For anybody ending up here with such issue, I fixed by preventing nginx running inside the Because the container host running seafile is running multiple services, I have to have an outer reverse proxy. And that reverse proxy is setting the This makes these two header inconsistent and causes gunicorn to show the error "Contradictory scheme headers". To fix, I edited
That's enough but for setting properly
This is my entire local network but service can only be accessed through the local outer reverse proxy anyway, so it doesn't really matter. I could put 0.0.0.0/0 in there. |
@akostadinov Hi. Cant seem to find this file nginx/conf/seafile.nginx.conf in any seafile container Disregard this...found it somewhere else :) Thanks for the help. This worked |
I have the same setup as @akostadinov (exterior proxy handling TLS, and the service in docker being HTTP-only). Commenting To avoid the issue altogether, I wonder whether the project can remove the
|
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.
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.
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.
In version 12.0, we will redesign the docker based deployment and move HTTPS to a dedicated reverse proxy. See https://manual.seafile.com/12.0/setup/overview/ At that time, please check the issue again. |
When using this nginx configuration:
Seafile throws Bad request "Contradictory scheme headers".
I removed every single header one by one and the error disappears when you either remove X-Forwarded-Proto OR X-Forwarded-Protocol. If you have only one of them, it works. If both, it doesn't.
I know it isn't necessary to use all these headers, but they are surely not contradictory.
(I use all of them just because each app uses different one and I use this as a template for every app.)
Seafile version: Docker seafileltd/seafile-mc:latest, tag: e0edf79c2d14,
The text was updated successfully, but these errors were encountered: