Can not get the real ip from client



When I deploy the sentry self-host,I can not see the real IP in the platform,which always show the ip,but the nginx log show the $remote_addr and $proxy_add_x_forwarded_for is or other.Can anybody help me ^ ^


Nginx log — - — [19/Oct/2021:03:21:15 +0000] “GET /api/0/organizations/sentry/issues/?collapse=stats&environment=production&expand=owners&expand=inbox&limit=25&project=4&query=is%3Aignored&shortIdLookup=1&statsPeriod=14d HTTP/1.1” 200 2 “” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36” “-”

Postgres Log

STATEMENT: INSERT INTO “sentry_eventuser” (“project_id”, “hash”, “ident”, “email”, “username”, “name”, “ip_address”, “date_added”) VALUES (4, ‘4934ef424b89468eaf610506e13a17ff’, NULL, NULL, NULL, NULL, ‘’::inet, ‘2021-10-19T02:40:25.287124+00:00’::timestamptz)


Self-Hosted Sentry 21.7.0

Can you share your full Nginx config?

Yes,here is the full config.Thanks for your reply :grin:

user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/;

events {
        worker_connections 1024;

http {
        default_type application/octet-stream;

        log_format main '$remote_addr --- $remote_user --- $proxy_add_x_forwarded_for [$time_local] "$request" '
        '$status $body_bytes_sent "$http_referer" '
        '"$http_user_agent" "$http_x_forwarded_for"';

        access_log /var/log/nginx/access.log main;

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        reset_timedout_connection on;

        keepalive_timeout 75s;

        gzip off;
        server_tokens off;

        server_names_hash_bucket_size 64;
        types_hash_max_size 2048;
        types_hash_bucket_size 64;
        client_max_body_size 100m;

        proxy_http_version 1.1;
        proxy_redirect off;
        proxy_buffering off;
        proxy_next_upstream error timeout invalid_header http_502 http_503 non_idempotent;
        proxy_next_upstream_tries 2;

        # Remove the Connection header if the client sends it,
        # it could be "close" to close a keepalive connection
        proxy_set_header Connection '';
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Request-Id $request_id;
        proxy_read_timeout 30s;
        proxy_send_timeout 5s;

        upstream relay {
                server relay:3000;

        upstream sentry {
                server web:9000;

       server {
        listen       443 ssl;
        ssl_certificate      /ssl/Server_Wildcard_sangfor_com_cn_20210316.cer;
        ssl_certificate_key  /ssl/Server_Wildcard_sangfor_com_cn_20210316.key;

        ssl_session_cache    shared:SSL:10m;
        ssl_session_timeout  5m;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM;
        ssl_prefer_server_ciphers  on;

        location / {
            location /api/store/ {
                    proxy_pass http://relay;
            location ~ ^/api/[1-9]\d*/ {
                    proxy_pass http://relay;
            location / {
                    proxy_pass http://sentry;
            proxy_set_header Host $host;

And your please? :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.