Open pb1dft opened 7 months ago
Can someone fix the code to support ssl reverse proxy with CORS support
My Diff on the code
diff --git a/auto_rx/autorx/web.py b/auto_rx/autorx/web.py index 1455a3c..c288dca 100644 --- a/auto_rx/autorx/web.py +++ b/auto_rx/autorx/web.py @@ -27,6 +27,7 @@ from threading import Thread import flask from flask import request, abort, make_response, send_file from flask_socketio import SocketIO + from werkzeug.middleware.proxy_fix import ProxyFix import re
@@ -45,7 +46,7 @@ cli.show_server_banner = lambda *x: None
app = flask.Flask(name) -app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_prefix=1) +app.wsgi_app = ProxyFix(app.wsgi_app, x_for=2, x_port=2, x_host=2, x_proto=2, x_prefix=2) app.config["SECRET_KEY"] = "secret!" app.config["TEMPLATES_AUTO_RELOAD"] = True app.jinja_env.auto_reload = True @@ -55,7 +56,7 @@ flask_app_thread = None flask_shutdown_key = None
-socketio = SocketIO(app, async_mode="threading") +socketio = SocketIO(app, cors_allowed_origins="*", async_mode="threading")
^^ Last line has a * in my config now would be nice to have that read from the settings file.
Regards Terence
Sorry to rise again the theme about the reverse proxy, it should be fixed since radiosonde_auto_rx ver.1.6.2, but i can't get it working, please some advice or working example of config.
Can someone fix the code to support ssl reverse proxy with CORS support
My Diff on the code
diff --git a/auto_rx/autorx/web.py b/auto_rx/autorx/web.py index 1455a3c..c288dca 100644 --- a/auto_rx/autorx/web.py +++ b/auto_rx/autorx/web.py @@ -27,6 +27,7 @@ from threading import Thread import flask from flask import request, abort, make_response, send_file from flask_socketio import SocketIO + from werkzeug.middleware.proxy_fix import ProxyFix import re
@@ -45,7 +46,7 @@ cli.show_server_banner = lambda *x: None
Instantiate our Flask app.
app = flask.Flask(name) -app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_prefix=1) +app.wsgi_app = ProxyFix(app.wsgi_app, x_for=2, x_port=2, x_host=2, x_proto=2, x_prefix=2) app.config["SECRET_KEY"] = "secret!" app.config["TEMPLATES_AUTO_RELOAD"] = True app.jinja_env.auto_reload = True @@ -55,7 +56,7 @@ flask_app_thread = None flask_shutdown_key = None
SocketIO instance
-socketio = SocketIO(app, async_mode="threading") +socketio = SocketIO(app, cors_allowed_origins="*", async_mode="threading")
^^ Last line has a * in my config now would be nice to have that read from the settings file.
Regards Terence