在Spring MVC中,如何检查引荐来源网址是否来自外部网站?

时间:2019-02-13 18:30:51

标签: java spring http

在Spring MVC中,我可以通过以下方式获取引荐来源网址:

String url = request.getHeader("referer");
// if external  then
   stats.setReferrer(url);

假设我的Web应用程序正在example.com(或处于开发模式的localhost或本地IP地址)上运行,如果引荐来源域名不是example.com(或localhost或本地IP地址),则在stats对象中设置引荐来源值。 / p>

如何解决这个问题?

0 个答案:

没有答案