Radicale icon indicating copy to clipboard operation
Radicale copied to clipboard

Potential bug: Radicale is not rewriting the redirect when HTTP_X_SCRIPT_NAME is set.

Open vinerich opened this issue 4 years ago • 1 comments

I tried to get a radicale-server working behind a reverse-proxy.

The way I wanted it to work is like this: sample.domain.com/radicale.

As stated in the docs one needs to add the x-script-name-header and remove the location (/radicale) from the request.

Expected behaviour

A request to sample.domain.com/radicale gets redirected to sample.domain.com/radicale/.web.

Got

A request to sample.domain.com/radicale gets redirected to sample.domain.com/.web.

Debug messages of request

[7f737829bb20] INFO: GET request for '/' received from '192.168.178.29' (forwarded by 172.19.0.3) using 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0'
[7f737829bb20] DEBUG: Request headers:
{'CONTENT_LENGTH': '',
 'CONTENT_TYPE': 'text/plain',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_ACCEPT_LANGUAGE': 'de,en-US;q=0.7,en;q=0.3',
 'HTTP_DNT': '1',
 'HTTP_HOST': 'sample.domain.com',
 'HTTP_UPGRADE_INSECURE_REQUESTS': '1',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) '
                    'Gecko/20100101 Firefox/73.0',
 'HTTP_X_FORWARDED_FOR': '192.168.178.29',
 'HTTP_X_FORWARDED_HOST': 'sample.domain.com',
 'HTTP_X_FORWARDED_PORT': '80',
 'HTTP_X_FORWARDED_PREFIX': '/radicale',
 'HTTP_X_FORWARDED_PROTO': 'http',
 'HTTP_X_FORWARDED_SERVER': '1dd0c1be93e4',
 'HTTP_X_REAL_IP': '192.168.178.29',
 'HTTP_X_SCRIPT_NAME': '/radicale/',
 'PATH_INFO': '/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '172.19.0.3',
 'REMOTE_HOST': '',
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': '',
 'SERVER_NAME': '92def7bf5bf8',
 'SERVER_PORT': '5232',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.2',
 'wsgi.errors': <_io.StringIO object at 0x7f73783034b0>,
 'wsgi.file_wrapper': <class 'wsgiref.util.FileWrapper'>,
 'wsgi.input': <_io.BufferedReader name=6>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}
[7f737829bb20] DEBUG: Script name overwritten by client: '/radicale/'
[7f737829bb20] DEBUG: Sanitized script name: '/radicale'
[7f737829bb20] DEBUG: Sanitized path: '/'
[7f737829bb20] DEBUG: Response content:
Redirected to .web
[7f737829bb20] INFO: GET response status for '/' in 0.000 seconds: 302 Found

vinerich avatar Mar 02 '20 16:03 vinerich