Ticket #476 (defect)
Opened 3 years ago
Last modified 3 years ago
BaseURLFilter doesn't use socket_port
Status: closed (fixed)
| Reported by: | Tomas Kolda | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.2-final |
| Component: | CherryPy code | Keywords: | |
| Cc: |
I'm using sessionAuthenticateFilter and it uses HTTPRedirect. But I use cherrypy on port 8080 and it redirects to urls without :8080.
Change History
03/03/06 04:30:47: Modified by Tomas Kolda
03/03/06 18:26:25: Modified by fumanchu
- status changed from new to closed.
- resolution set to fixed.
- summary changed from Redirect on other ports to BaseURLFilter doesn't use socket_port.
Fixed in [998].


There was my fault, because baseUrlFilter was turned on. Then it rewrites base without using port and using hardcoded localhost. Maybe this is better:
Index: filters/baseurlfilter.py =================================================================== --- filters/baseurlfilter.py (revision 995) +++ filters/baseurlfilter.py (working copy) @@ -13,7 +13,11 @@ return request = cherrypy.request - newBaseUrl = cherrypy.config.get('base_url_filter.base_url', 'http://localhost') + if cherrypy.config.get('server.socketPort', 80) == 80: + defaultUrl = 'http://localhost' + else: + defaultUrl = 'http://localhost:%d' % cherrypy.config.get('server.socketPort', 80) + newBaseUrl = cherrypy.config.get('base_url_filter.base_url', defaultUrl) if cherrypy.config.get('base_url_filter.use_x_forwarded_host', True): newBaseUrl = request.headers.get("X-Forwarded-Host", newBaseUrl)