@@ -4,7 +4,5 @@ COPY Pipfile Pipfile.lock docker-setup.sh /app/ | |||
RUN /app/docker-setup.sh | |||
COPY . /app | |||
EXPOSE 5000 | |||
WORKDIR /app | |||
ENTRYPOINT ["uvicorn", "--proxy-headers", "app:app", "--host", "0.0.0.0", "--port", "5000"] | |||
ENTRYPOINT ["uvicorn", "--proxy-headers", "--forwarded-allow-ips='*'", "app:app", "--uds", "/mnt/workdir/uvicorn.sock"] |
@@ -82,7 +82,8 @@ async def render_main(req: Request): | |||
@app.post('/action/flag') | |||
async def handle_flag(req: Request, date: str = Form(...), article: str = Form(...)): | |||
ipaddr = req.client.host | |||
xff = req.headers['X-Forwarded-For'] if 'X-Forwarded-For' in req.headers else None | |||
ipaddr = xff if xff is not None else req.client.host | |||
try: | |||
today = datetime.now() |