当前位置: 动力学知识库 > 问答 > 编程问答 >

java - If http.path is set, is there a way to provide a route for /

问题描述:

I have in my application.conf

http.path=/manage

So, when I go to http://localhost:9000/ I get a Not Found 404 page.

Is there a way to redirect / to /manage/ while still keeping the app at http.path=/manage ?

网友答案:

From the documentation, the http.path setting is used for,

The URL path where the application runs on the server: use this if you do not host your Play application at the root of the domain you’re serving it from. This parameter has no effect when deployed as a WAR, because the path will be handled by the application server.

If this is not the case, then you may be better off using your routes file to manage the URLs, so that you specify both the / and /manage, and the action for the index page is a simple redirect to the action that you want to forward on to.

The other option is to front your Play server with an HTTP server, like Apache or Lighttp, and perform the redirect within the HTTP server config. This is actually what the http.path is meant to be used for, to help play applications co-exist in an existing web server environment.

分享给朋友:
您可能感兴趣的文章:
随机阅读: