Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for CORS on SSL #834

Open
pb1dft opened this issue Nov 7, 2023 · 1 comment
Open

Fix for CORS on SSL #834

pb1dft opened this issue Nov 7, 2023 · 1 comment

Comments

@pb1dft
Copy link

pb1dft commented Nov 7, 2023

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

@73-de-LZ
Copy link

73-de-LZ commented Feb 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants