开发者

Can't get Client IP Address connected through a proxy using request.getHeader("x-forwarded-for");

I tried to get client ip address connected server through a proxy by the following:

PrintWriter out=response.getWriter();
out.println("x-forwarded-for : "+request.getHeader("x-forwarded-for"));

out.println("remote : "+request.getRemoteAddr());

But I get always null from getHeader("x-forwarded-for") method.

I get only remote address by getRemoteAddr().

But I开发者_如何学Python tried spoofer firefox plugin and it works.

Anybody knows the solution? Thanks.


You need to check if that proxy server indeed add the 'x-forwarded-for' header to the request. A proxy server is not obligatory to do so.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜