简体   繁体   中英

Preserving the Client IP Address in Sun Java System Web Server

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.

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() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM