My Flask/Shiny app needs url_for to allow for more functions than just 'root'; '/' and this worked in Domino 3.6
The quick-start project does not allow me to do this in Domino 4?
An underlying change seems to have made a rewrite method stop working but please check your quick-start project which may contain the Domino 3.6 version and not been updated to work with those changes.
We can add the ProxyFix middleware and used it in conjunction with the ReverseProxied class already in the quick-start project:
Add import:
try:
from werkzeug.middleware.proxy_fix import ProxyFix
except ModuleNotFoundError: # werkzeug < 1.0.0
from werkzeug.contrib.fixers import ProxyFix
Modify ReverseProxied class:
class ReverseProxied(object):
def __init__(self, app):
self.app = ProxyFix(app, x_for=1, x_host=1)
def __call__(self, environ, start_response):
script_name = environ.get('HTTP_X_SCRIPT_NAME', '')
if script_name:
environ['SCRIPT_NAME'] = script_name
path_info = environ['PATH_INFO']
if path_info.startswith(script_name):
environ['PATH_INFO'] = path_info[len(script_name):]
return self.app(environ, start_response)
Comments
0 comments
Please sign in to leave a comment.