Tomcat: getHeader(“Host”) vs. getServerName()

后端 未结 4 435
南方客
南方客 2020-12-16 01:06

I\'ve got a Tomcat app that is being served up from multiple domains. Previous developers built a method to return the application URL (see below). In the method they reques

4条回答
  •  情话喂你
    2020-12-16 01:54

    Maybe not related to this question. If you are using tomcat, you can specify any Host string in the request header, even javascript like

    Then it could be shown on the page.:

    host name is : <%= request.getServerName() %>

    So you need to verify it before using it.

提交回复
热议问题