linh-hk commited on
Commit
82059dc
·
1 Parent(s): 3c85b91

Proxy fix

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -3,6 +3,7 @@ import flask
3
  from flask_socketio import SocketIO, emit, join_room, leave_room
4
  import eventlet
5
  from core.mtdna_backend import *
 
6
 
7
  print("CWD:", os.getcwd())
8
  print("templates/ exists:", os.path.isdir("templates"), "->", os.listdir("templates") if os.path.isdir("templates") else "missing")
@@ -14,8 +15,10 @@ isvip = True # or True depending on the user
14
  app = flask.Flask(__name__, static_folder="static", template_folder="templates", static_url_path="/static")
15
  app.config["DEBUG"] = True
16
  app.config["SECRET_KEY"] = "dev-key"
 
17
  socketio = SocketIO(app, async_mode="eventlet", cors_allowed_origins="*")
18
 
 
19
  # --- job registry for cancel flags ---
20
  # Use a simple boolean flag in eventlet mode: True => cancel requested
21
  CANCEL_FLAGS = {} # {job_id: bool}
 
3
  from flask_socketio import SocketIO, emit, join_room, leave_room
4
  import eventlet
5
  from core.mtdna_backend import *
6
+ from werkzeug.middleware.proxy_fix import ProxyFix
7
 
8
  print("CWD:", os.getcwd())
9
  print("templates/ exists:", os.path.isdir("templates"), "->", os.listdir("templates") if os.path.isdir("templates") else "missing")
 
15
  app = flask.Flask(__name__, static_folder="static", template_folder="templates", static_url_path="/static")
16
  app.config["DEBUG"] = True
17
  app.config["SECRET_KEY"] = "dev-key"
18
+ app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1)
19
  socketio = SocketIO(app, async_mode="eventlet", cors_allowed_origins="*")
20
 
21
+
22
  # --- job registry for cancel flags ---
23
  # Use a simple boolean flag in eventlet mode: True => cancel requested
24
  CANCEL_FLAGS = {} # {job_id: bool}