diff --git a/Dockerfile b/Dockerfile index 14694bc..3d0250b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,4 +5,4 @@ COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . EXPOSE 8000 -CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"] +CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*"] diff --git a/api.py b/api.py index 3b4221c..764f5d6 100644 --- a/api.py +++ b/api.py @@ -104,7 +104,7 @@ async def read_root(): def run(): # Read port from environment variable, default to 8000 port = int(os.environ.get("PORT", 8000)) - uvicorn.run(app, host="0.0.0.0", port=port) + uvicorn.run(app, host="0.0.0.0", port=port, proxy_headers=True, forwarded_allow_ips="*") if __name__ == "__main__":