Hello, anyone
the code (app.py):
from flask import Flask
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
sentry_sdk.init(
dsn=“https://<some_key>@<mydomain.ltd>/32”,
integrations=[FlaskIntegration()],
)
app = Flask(name)
@app.route(’/’)
def hello_world():
return 1/0
Dockerfile:
FROM python:3.7-alpine
RUN pip install flask sentry-sdk sentry-sdk[flask]
COPY app.py /opt/app.py
ENV FLASK_APP=/opt/app.py
CMD flask run --host=0.0.0.0
nginx_vhost.conf:
server {
location / { return 444; }
location /some_location/ {
rewrite ^/some_location/(.+)?$ /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-User-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Url $host/some_location;
proxy_pass http://app:5000;
}
}
docker-compose.yml:
version: “3.9”
services:
app:
build: .
nginx:
image: nginx:alpine
ports:
- 80:80
volumes:
- ./nginx_vhost.conf:/etc/nginx/conf.d/default.conf
depends_on:
- app
docker-compose up -d…
curl localhost > get 500 (it’s ok)
but on sentry web:
On screenshot url: http://localhost:5000/
is there a way to change the url tag from url “http://localhost:5000/” to value from X-Forwarded-Url? (on example: localhost/some_location/)
Thanks in advance