Home  >  Q&A  >  body text

java - nginx affects request value

After passing the nginx proxy, the value of request.getSession(true).getServletContext() is null. If you directly access tomcat with IP and port, you can get the path. Is there any expert who has encountered this problem?
someone said:

proxy_set_header       Host $host;   //解决getRequestURL、getServerName、getServerPort

But proxy_set_header has been added

阿神阿神2714 days ago394

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:08:55

    Try using request.getServletContext()

    reply
    0
  • Cancelreply