Redirecting from port 80 to different ports based on URL

与世无争的帅哥 提交于 2019-11-30 11:37:36

问题


I have two applications, (Atlassian JIRA and Confluence,) listening on ports 8080 and 8090, accessible through example.com:8080/jira and example.com:8090/confluence. I would like to set up a redirection on port 80 such that I can access the services through example.com/jira and example.com/confluence.

Is there a simple way to achieve this?


回答1:


There are 2 ways of solving this.

Redirect Method

  1. You seem pretty savvy setting up servers. You will need a web Server running on port 80. (Apache: Windows/*nix; IIS: Windows)
  2. Set up a virtual site / folder if you just want example.com/jira and example.com/confluence. You could also do jira.example.com and confluence.example.com if you had your DNS records pointing to the host.
  3. Use a 302 Redirect (temporary/found) to redirect a browser hitting this URL/Virtual Host to the new URL. This method changes the URL in the browser so the browser actually shows the 8080 and 8090 ports.

Proxy Method

The other way, if you wanted transparent URLs would be to set up reverse proxies on the 2 URLs. This way the proxy server on port 80 responds to the client as if the content is originating from port 80. The web server fetches the pages in the background and serves them up. You have the added benefit of caching content using a reverse proxy.



来源:https://stackoverflow.com/questions/27997071/redirecting-from-port-80-to-different-ports-based-on-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!