开发者

Prevent access to java web application other than localhost

开发者 https://www.devze.com 2022-12-16 22:18 出处:网络
I have a web application running in jetty. I have to provide a configurat开发者_Go百科ion, like when the flag is set true access should be granted to users access the web application through ip instea

I have a web application running in jetty. I have to provide a configurat开发者_Go百科ion, like when the flag is set true access should be granted to users access the web application through ip instead of localhost. If the flag is not set to true, then the request other than localhost should be denied. How to do this?

Thanks.


If you want to do this from your application (not changing jetty configuration), you can write a filter servlet for your application, and using ServletRequest#getRemoteAddr() to know where come from the request.

0

精彩评论

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

关注公众号