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

HTTP_X_SCRIPT_NAME not removed from PATH_INFO #803

Closed
drwilly opened this issue Apr 9, 2018 · 6 comments
Closed

HTTP_X_SCRIPT_NAME not removed from PATH_INFO #803

drwilly opened this issue Apr 9, 2018 · 6 comments
Labels
need:reporter feedback feedback from reporter required reverse proxy reverse proxy related reverse-proxy:nginx related to reverse proxy "nginx"

Comments

@drwilly
Copy link

drwilly commented Apr 9, 2018

I just migrated from radicale 1 to 2. My setup is nginx -> uwsgi -> radicale.
I used to rely on the base_prefix in radicale's config to get the SCRIPT_NAME and PATH_INFO parameters right which apparently is no longer possible.
My understanding of the parameter HTTP_X_SCRIPT_NAME is that it should overwrite SCRIPT_NAME and be stripped off of PATH_INFO. So if HTTP_X_SCRIPT_NAME = /radicale and PATH_INFO = /radicale/myuser/ then the latter should be rewritten to /myuser/.
However that does not seem to be the case: https://github.com/Kozea/Radicale/blob/master/radicale/__init__.py#L404

@Unrud
Copy link
Collaborator

Unrud commented Apr 21, 2018

This is the expected behaviour (see https://www.python.org/dev/peps/pep-0333/).
My suspicion is that nginx is not configured correctly: http://radicale.org/proxy/
The trailing slash causes nginx to strip /radicale from the path.

@Unrud Unrud added the need:reporter feedback feedback from reporter required label May 4, 2018
@drwilly
Copy link
Author

drwilly commented May 17, 2018

Sorry it took me a while. Regardless ...
I am unsure how to translate the reverse-proxy configuration to my wsgi setup.
My working config looks as follows:

                location ~ ^/radicale(/.*|$) {
                        include                 uwsgi_params;
                        uwsgi_param SCRIPT_NAME /radicale;
                        uwsgi_param PATH_INFO   $1;
                        uwsgi_param REMOTE_USER $remote_user;
                        uwsgi_pass              unix:/run/uwsgi/radicale.socket;

                        auth_basic              "Restricted";
                        auth_basic_user_file    radicale.passwd;
                }

However as you can see it requires some url-matching and parameter-fiddling.
A plain location /radicale/ without explicitly setting PATH_INFO does not work.

@pbiering
Copy link
Collaborator

pbiering commented Mar 1, 2024

@chripo : is this still an issue with Radicale major version 3? If not, please close.

@pbiering pbiering added the old version relates to no longer supported versions label Mar 2, 2024
@mazhe
Copy link

mazhe commented Jun 19, 2024

I was just reviewing my own radicale configuration for refresh and can confirm this is still an issue (tested with radicale 3.1.18, will update soon to 3.2.x and nginx 1.24.0)

@pbiering pbiering added reverse proxy reverse proxy related and removed old version relates to no longer supported versions question labels Jun 20, 2024
@pbiering
Copy link
Collaborator

I've did a major review of the "apache" reverse proxy config example (supporting 4 different flavors) and stored a template in the repository now: https://github.com/Kozea/Radicale/blob/master/contrib/apache/radicale.conf

Can you please align your "nginx" configuration and check whether the issue disappears then?

@pbiering pbiering added the reverse-proxy:nginx related to reverse proxy "nginx" label Oct 18, 2024
@pbiering
Copy link
Collaborator

there are now also small nginx config examples in repo https://github.com/Kozea/Radicale/tree/master/contrib/nginx - please validate and reopen if there is still an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need:reporter feedback feedback from reporter required reverse proxy reverse proxy related reverse-proxy:nginx related to reverse proxy "nginx"
Projects
None yet
Development

No branches or pull requests

4 participants