Apache: consolidate dev+prod into single Include-style snippet

Match the convention used by every other app on optical-{dev,prod}:
each app ships one /opt/<app>/deploy/<app>.conf, and the per-host
vhost adds a single `Include` line.

Combines apache-dev.conf and apache-prod.conf (which were identical)
into apache-hm-aiqc.conf. Drops X-Forwarded-Proto and ProxyPreserveHost
since the parent vhost already sets them globally. Raises the body
size to 500MB inside /hm-aiqc/ for video uploads.
This commit is contained in:
nickviljoen 2026-05-09 17:05:39 +02:00
parent aacefbd7df
commit 7622b650af
3 changed files with 37 additions and 56 deletions

View file

@ -1,28 +0,0 @@
# Apache Location block for HM AI QC on optical-dev.
#
# Insert inside the existing <VirtualHost *:443> for
# ServerName optical-dev.oliver.solutions
# and reload:
# sudo systemctl reload apache2
#
# Required modules (enable once if not already):
# sudo a2enmod proxy proxy_http headers
#
# The X-Script-Name header is read by wsgi.py's ReverseProxied middleware
# so url_for() generates URLs prefixed with /hm-aiqc.
ProxyPass /hm-aiqc/ http://127.0.0.1:5050/
ProxyPassReverse /hm-aiqc/ http://127.0.0.1:5050/
# Bare /hm-aiqc (no trailing slash) → redirect with slash so the prefix matches
RewriteEngine On
RewriteRule ^/hm-aiqc$ /hm-aiqc/ [R=301,L]
<Location /hm-aiqc/>
RequestHeader set X-Script-Name "/hm-aiqc"
RequestHeader set X-Forwarded-Proto "https"
ProxyPreserveHost On
# Long-running endpoints (QC execution, Box searches, video analysis)
ProxyTimeout 600
</Location>

View file

@ -0,0 +1,37 @@
# HM AI QC — Apache snippet (Include'd into the per-host vhost).
#
# Wire-up on each server:
# /etc/apache2/sites-enabled/<host>.conf — already exists for OliVAS etc.
# Add inside the existing <VirtualHost *:80> block (next to the other
# per-app Include lines):
#
# Include /opt/hm-aiqc/deploy/apache-hm-aiqc.conf
#
# Then: sudo apache2ctl configtest && sudo systemctl reload apache2
#
# Required modules (enable once if not already):
# sudo a2enmod proxy proxy_http headers rewrite
#
# This server fronts plain HTTP only — SSL is terminated by the upstream
# load balancer. The parent vhost already sets X-Forwarded-Proto: https
# and ProxyPreserveHost On globally, so we don't repeat them here.
#
# X-Script-Name is read by wsgi.py's ReverseProxied middleware so Flask's
# url_for() emits /hm-aiqc/... prefixes correctly.
ProxyPass /hm-aiqc/ http://127.0.0.1:5050/
ProxyPassReverse /hm-aiqc/ http://127.0.0.1:5050/
# /hm-aiqc (no trailing slash) → /hm-aiqc/
RewriteEngine On
RewriteRule ^/hm-aiqc$ /hm-aiqc/ [R=301,L]
<Location /hm-aiqc/>
RequestHeader set X-Script-Name "/hm-aiqc"
# Video uploads can exceed the 100MB vhost-wide cap — raise to 500MB here
LimitRequestBody 524288000
# Long-running endpoints (QC execution, Box searches, video analysis)
ProxyTimeout 600
</Location>

View file

@ -1,28 +0,0 @@
# Apache Location block for HM AI QC on optical-prod.
#
# Insert inside the existing <VirtualHost *:443> for
# ServerName optical-prod.oliver.solutions
# and reload:
# sudo systemctl reload apache2
#
# Required modules (enable once if not already):
# sudo a2enmod proxy proxy_http headers
#
# The X-Script-Name header is read by wsgi.py's ReverseProxied middleware
# so url_for() generates URLs prefixed with /hm-aiqc.
ProxyPass /hm-aiqc/ http://127.0.0.1:5050/
ProxyPassReverse /hm-aiqc/ http://127.0.0.1:5050/
# Bare /hm-aiqc (no trailing slash) → redirect with slash so the prefix matches
RewriteEngine On
RewriteRule ^/hm-aiqc$ /hm-aiqc/ [R=301,L]
<Location /hm-aiqc/>
RequestHeader set X-Script-Name "/hm-aiqc"
RequestHeader set X-Forwarded-Proto "https"
ProxyPreserveHost On
# Long-running endpoints (QC execution, Box searches, video analysis)
ProxyTimeout 600
</Location>