]> OzVa Git service - critters-api/commitdiff
Added proxyfix and WSGI script
authorMax Value <greenwoodw50@gmail.com>
Mon, 9 Dec 2024 06:08:48 +0000 (06:08 +0000)
committerMax Value <greenwoodw50@gmail.com>
Mon, 9 Dec 2024 06:08:48 +0000 (06:08 +0000)
index.py
wsgi.py [new file with mode: 0644]

index 7765fc3f6bb42663131be55ec204d76e8c3e1dd8..f842953013a5284fc7be85900c73f3c39c32daf7 100755 (executable)
--- a/index.py
+++ b/index.py
@@ -3,6 +3,7 @@
 from flask import Flask, Response, request, render_template, redirect, send_from_directory, url_for
 from flask_httpauth import HTTPBasicAuth
 from werkzeug.security import generate_password_hash, check_password_hash
+from werkzeug.middleware.proxy_fix import ProxyFix
 from multiprocessing import Value
 from os import listdir
 import sqlite3
@@ -11,6 +12,9 @@ import json
 import os.path
 
 app = Flask(__name__)
+app.wsgi_app = ProxyFix(
+    app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1
+)
 auth = HTTPBasicAuth()
 db_keys = ["title", "album", "artist", "year", "link", "info", "category", "playing", "intime", "outtime"]
 allowed_audio = ["mp3", "wav", "ogg", "flac"]
diff --git a/wsgi.py b/wsgi.py
new file mode 100644 (file)
index 0000000..d659370
--- /dev/null
+++ b/wsgi.py
@@ -0,0 +1,5 @@
+#! .venv/bin/python3
+
+from index import app
+
+application = app