From 329e22cfd6b9b74df7f2d2de826d350e78999670 Mon Sep 17 00:00:00 2001 From: directlx Date: Sun, 25 Jan 2026 16:49:39 -0500 Subject: [PATCH] Configure app for Nginx Proxy Manager reverse proxy. Add ProxyFix middleware to Flask and X-Forwarded-Host header to nginx config for proper proxy header handling. --- app.py | 4 ++++ nginx.conf | 1 + static/css/styles.css | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/app.py b/app.py index d9be10d..bdb2954 100644 --- a/app.py +++ b/app.py @@ -2,6 +2,7 @@ import os from datetime import datetime from flask import Flask, render_template, request, redirect, url_for, flash, jsonify from slugify import slugify +from werkzeug.middleware.proxy_fix import ProxyFix from config import config from models import db, User, BlogPost, ForumCategory, ForumTopic, ForumReply, ContactMessage @@ -14,6 +15,9 @@ def create_app(config_name=None): app = Flask(__name__) app.config.from_object(config[config_name]) + # Trust proxy headers from Nginx Proxy Manager → local nginx (2 proxies) + app.wsgi_app = ProxyFix(app.wsgi_app, x_for=2, x_proto=1, x_host=1, x_prefix=1) + db.init_app(app) with app.app_context(): diff --git a/nginx.conf b/nginx.conf index 579a252..90f8bea 100644 --- a/nginx.conf +++ b/nginx.conf @@ -16,6 +16,7 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; proxy_connect_timeout 300s; proxy_read_timeout 300s; } diff --git a/static/css/styles.css b/static/css/styles.css index 347bd2e..dda3e8d 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -873,6 +873,10 @@ video { height: 4rem; } +.h-20 { + height: 5rem; +} + .h-24 { height: 6rem; }