When configuring reverse proxy with nginx, the option "Use Client IP in Header" usually works fine.
Code:
server {
listen 80;
server_name _;
location / {
proxy_pass http://1.1.1.1;
include proxy_params;
}
}
However, when using nginx to proxy tcp stream, this option may not work properly.
Code:
stream {
include proxy_streams.conf;
server {
listen 80;
proxy_protocol on;
proxy_pass 1.1.1.1:80;
}
}
When accessing the website, a "400 Bad Request" error is returned. This is because OpenLiteSpeed does not support the PROXY protocol. If it did support the PROXY protocol, then the error would not occur. For example, Apache or Nginx support the PROXY protocol, which would enable obtaining the visitor's real IP when using tcp stream as a proxy.