search

Home  >  Q&A  >  body text

java - 服务器访问应用返回302或者404状态码

如用weblogic或者tomcat部署仅有一个应用如A,然后用curl命令发一个HTTP请求但是发送的时候修改了Host头
1 http://ip:port/A --> 返回302 Moved Temporarily
2 http://ip:port/A/ --> 返回正常,可能是A应用下的index.html
3 http://ip:port/B --> 返回404
自己对上面的现象比较疑惑,希望高手解答一下

天蓬老师天蓬老师2882 days ago646

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-18 10:32:31

    A in the URL is the name of the application you deployed in weblogic or tomcat. It is also called WebRoot during development. After the web application is deployed, you can access published resources or pages through http://ip:port/A/+resource name. The resource name is defined by you during development. If you don't understand this, it won't be solved in a short time. Please briefly explain the error reporting when you access it:
    1 http://ip:port/A --> Return 302 Moved Temporarily [Wrong access method, no need to explain]
    2 http://ip:port/A/ --> Returns to normal, maybe index.html under A application [This is defined in the web application, of course you can Customize the jump page by modifying the web.xml file configuration]
    3 http://ip:port/B --> Returns 404 [Because you have not deployed the web application named B at all, it is prompting you that the resource does not exist 】

    One more thing, learning does not happen overnight. It is recommended that you learn Java honestly and down-to-earth, and don’t eat fat in one bite, otherwise you will have many problems that you can’t figure out... (I recommend you a learning reference website: Geek College)

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:32:31

    302 refers to redirection
    404 You are visiting a project that does not exist and the page cannot be found 404
    Direct access will access the index.jsp page by default~

    reply
    0
  • Cancelreply