#13415 closed defect (fixed)
tracd is redirecting to http when using https
| Reported by: | Owned by: | Jun Omae | |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.4.4 |
| Component: | web frontend/tracd | Version: | 1.4 |
| Severity: | normal | Keywords: | https, redirect |
| Cc: | Branch: | ||
| Release Notes: |
Fix wrong redirect when |
||
| API Changes: | |||
| Internal Changes: | |||
Description (last modified by )
Hi,
we are using tracd for a small internal team on a non standard port. Recently we switched to https for internal reasons. So we added the required parameters to tracd and restarted. At first glance everything was fine. But after some days we noticed that sometimes Trac was sending us back to http. First we thought about the browser cache. But after some debugging I found out that trac was redirecting us to http via the Location http header.
The first solution was to switch use_base_url_for_redirect on inside [trac]
But due to the concerns about use_base_url_for_redirect from the docs i wanted to find a better solution.
So i debugged and found out that the scheme=http is set from the WSGIGateway.__init__ where some additional checks are also performt. One of those is if the environment has the Variable HTTPS set to "yes". So i added a workaround to tracd (trac.web.standalone)
I added the following to the case where httpd.socket = ssl.wrap_socket(...) is also called as this seems appropriate.
httpd.environ["HTTPS"]="yes"
Attachments (0)
Change History (6)
comment:1 by , 4 years ago
| Description: | modified (diff) |
|---|---|
| Keywords: | wsgi http removed |
follow-up: 4 comment:2 by , 4 years ago
comment:3 by , 4 years ago
| Milestone: | → 1.4.4 |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
Well, that makes sense.
comment:4 by , 4 years ago
Replying to Jun Omae:
Are you saying you've patched like this?
trac/web/standalone.py
diff --git a/trac/web/standalone.py b/trac/web/standalone.py index 5b41b6802..41a414acc 100755
a b def main(): 346 346 httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, 347 347 certfile=args.certfile, 348 348 keyfile=args.keyfile) 349 httpd.environ['HTTPS'] = 'yes' 349 350 httpd.serve_forever() 350 351 elif args.protocol in ('scgi', 'ajp', 'fcgi'): 351 352 def serve():
exactly
comment:5 by , 4 years ago
| Keywords: | tracd removed |
|---|---|
| Release Notes: | modified (diff) |
| Resolution: | → fixed |
| Status: | assigned → closed |
comment:6 by , 4 years ago
| Release Notes: | modified (diff) |
|---|



Are you saying you've patched like this?
trac/web/standalone.py