Commits

Robert Brewer committed 2858abd

Fix for #476 (BaseURLFilter doesn't use socket_port).

Comments (0)

Files changed (1)

cherrypy/filters/baseurlfilter.py

             return
         
         request = cherrypy.request
-        newBaseUrl = cherrypy.config.get('base_url_filter.base_url', 'http://localhost')
+        
+        port = str(cherrypy.config.get('server.socket_port', '80'))
+        if port == "80":
+            defaultUrl = 'http://localhost'
+        else:
+            defaultUrl = 'http://localhost:%s' % port
+        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)