feat: uvicorn Proxy-Headers fuer Reverse-Proxy-Betrieb
This commit is contained in:
@@ -1,4 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
alembic upgrade head
|
alembic upgrade head
|
||||||
exec uvicorn app.main:app --host 0.0.0.0 --port 8000
|
# --proxy-headers + --forwarded-allow-ips='*': hinter dem Reverse Proxy
|
||||||
|
# (Traefik→Apache/TLS) wertet uvicorn X-Forwarded-Proto/-Host aus, damit
|
||||||
|
# request.url das öffentliche https/Host statt des pod-internen http sieht.
|
||||||
|
# '*' ist vertretbar, weil der Pod nur an 127.0.0.1 gebunden ist und nur der
|
||||||
|
# lokale Traefik ihn erreicht (siehe docs/reverse-proxy.md). Im Direktbetrieb
|
||||||
|
# ohne Proxy sendet niemand X-Forwarded-*, also bleibt das Verhalten gleich.
|
||||||
|
exec uvicorn app.main:app --host 0.0.0.0 --port 8000 \
|
||||||
|
--proxy-headers --forwarded-allow-ips='*'
|
||||||
|
|||||||
9
finance/tests/test_entrypoint.py
Normal file
9
finance/tests/test_entrypoint.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ENTRYPOINT = Path(__file__).resolve().parent.parent / "entrypoint.sh"
|
||||||
|
|
||||||
|
|
||||||
|
def test_entrypoint_enables_proxy_headers():
|
||||||
|
text = ENTRYPOINT.read_text()
|
||||||
|
assert "--proxy-headers" in text
|
||||||
|
assert "--forwarded-allow-ips" in text
|
||||||
Reference in New Issue
Block a user