问题
I am attempting to set the UI Router location provider html5Mode to true for my Angular application: locationProvider.html5Mode(true)
. While this works client side (appropriately redirects) I am running into issues server side. I am running an instance Java Enterprise Edition on Google App Engine.
I have configured my web.xml
as outlined for Java EE section in the Angular ui-router FAQ:
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<error-page>
<error-code>404</error-code>
<location>/</location>
</error-page>
<servlet>
<servlet-name>SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>
<!-- stuff specific to my GAE app -->
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SystemServiceServlet</servlet-name>
<url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
Sadly even with the above configuration when I browse to client based routes I am still receiving a 404 error from the server. I have tried various values (/index.html
, index.html
) for the error-page > location
element with the same result.
I am probably missing something obvious in my configuration, but am at a loss to what I am doing wrong.
来源:https://stackoverflow.com/questions/41783634/how-do-i-configure-java-ee-running-on-gae-to-work-with-angular-ui-router-in-html