Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudServer clientIP 127.0.0.1 not read X-Real-IP nginx proxy-pass #5387

Open
mewallkit opened this issue Oct 14, 2023 · 2 comments
Open

CloudServer clientIP 127.0.0.1 not read X-Real-IP nginx proxy-pass #5387

mewallkit opened this issue Oct 14, 2023 · 2 comments

Comments

@mewallkit
Copy link

server {
    listen 443 ssl;
    server_name example.ru;

    ssl_certificate /etc/nginx/ssl/example-ru.crt;`
    ssl_certificate_key /etc/nginx/ssl/example-ru.key;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

sniffing data

'GET / HTTP/1.0'
'Host: example.ru'
'X-Real-IP: XXX.XXX.XXX.XXX'
'Connection: close', 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0'
...

cloudserver log clientIP 127.0.0.1 not X-Real-IP

what needs to be done, or this behavior is not provided, which is most likely?

@rachedbenmustapha
Copy link
Contributor

By default, for security reasons, real ip extraction from headers is disabled, but can be configured in the requests section.

@mewallkit
Copy link
Author

...
    "requests": {
        "viaProxy": true,
        "trustedProxyCIDRs": ["127.0.0.1/8", "::1"],
        "extractClientIPFromHeader": "X-Real-IP"
    },
...

I tried different options, the last thing I tried looked like this, it didn't change the behavior was still in the output...

{"name":"S3","clientIP":"::ffff:127.0.0.1","clientPort":56564,"httpMethod":"GET","httpURL":"....

there are suggestions that you can still change or fix something that I did wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants