Skip to content

Commit

Permalink
Merge pull request #1303 from pbiering/MOVE-on-non-standard-server-ports
Browse files Browse the repository at this point in the history
MOVE on non standard server ports
  • Loading branch information
pbiering authored Mar 1, 2024
2 parents e6d4611 + fadf281 commit 9f1e243
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ RewriteRule ^/radicale$ /radicale/ [R,L]
ProxyPass http://localhost:5232/ retry=0
ProxyPassReverse http://localhost:5232/
RequestHeader set X-Script-Name /radicale
RequestHeader set X-Forwarded-Port "%{SERVER_PORT}s"
RequestHeader unset X-Forwarded-Proto
<If "%{HTTPS} =~ /on/">
RequestHeader set X-Forwarded-Proto "https"
</If>
</Location>
```

Expand All @@ -384,6 +389,11 @@ RewriteRule ^(.*)$ http://localhost:5232/$1 [P,L]
# Set to directory of .htaccess file:
RequestHeader set X-Script-Name /radicale
RequestHeader set X-Forwarded-Port "%{SERVER_PORT}s"
RequestHeader unset X-Forwarded-Proto
<If "%{HTTPS} =~ /on/">
RequestHeader set X-Forwarded-Proto "https"
</If>
```

Example **lighttpd** configuration:
Expand Down
1 change: 1 addition & 0 deletions radicale/app/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def get_server_netloc(environ: types.WSGIEnviron, force_port: bool = False):
host = environ["HTTP_X_FORWARDED_HOST"]
proto = environ.get("HTTP_X_FORWARDED_PROTO") or "http"
port = "443" if proto == "https" else "80"
port = environ["HTTP_X_FORWARDED_PORT"] or port
else:
host = environ.get("HTTP_HOST") or environ["SERVER_NAME"]
proto = environ["wsgi.url_scheme"]
Expand Down

0 comments on commit 9f1e243

Please sign in to comment.