# X-Real-IP 紀錄使用者原始IP來源 Nginx 可以在location 加入 X-Real-IP 來記錄使用者原始IP來源 因為透過Nginx處理後,在Web端使用request.getRemoteAddr()時,只會拿到Nginx的IP 所以在Nginx這邊的$remote_addr 就可以紀錄使用者原始IP來源 ```console=\ location ~^ /your-service/ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } ``` 在Web端這邊只要 request.getHeader("X-Real-IP") 就可以拿到使用者原始IP來源了
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up