开发者

Preserving the Client IP Address in Sun Java System Web Server

开发者 https://www.devze.com 2023-02-25 03:28 出处:网络
We are running Sun java System Web server 7.0 and Sun Java System App Server 9.1 (glassfish) in our environment.

We are running Sun java System Web server 7.0 and Sun Java System App Server 9.1 (glassfish) in our environment.

We need to perform some access control check in the application based on the client's IP address. Currently the method request.getRemoteAddr() when called from the application returns the Webserver's IP address. The method request.getHeader("HTTP_X_FORWARDED_FOR") returns null.

Looks like the web server is changing the header before forwarding to the application server.

开发者_JS百科

Is there a way to let the Sun Java webserver retain the original client IP address in the request?

Please let me know.

Thanks


Try request.getHeader("x-forwarded-for"). I tested it for Squid.

You can see every parameters names by iterating through request.getParameterNames().

0

精彩评论

暂无评论...
验证码 换一张
取 消