I have enabled the html5mode for an AngularJS app and have a question about configuring the URLrewrite. I referenced this post and realized that my issues is with the urlrewrite configuration.
My goal is to have all calls written back to the index.html so the angular router can route properly. Below is my existing configuration. I have tried many different types, but cannot seem to get the rewrite to work properly:
~~ urlrewrite.xml ~~
<urlrewrite default-match-type="wildcard">
<rule>
<from>/**</from>
<to>/index.html</to>
</rule>
<outbound-rule>
<from>/**</from>
<to>/index.html</to>
</outbound-rule>
</urlrewrite>
Any pointers on what i'm doing wrong?
I know this is an quite old post, but since I have stumpled upon it while trying to achieve the same - I will provide an answer with my solution.
Provided that urlrewritefilter has been configured properly, add the following to urlrewrite.xml:
This rule will catch all requests
^(.*)$
as the "from" element is missing. Ofcourse you'll need to add routes specific to your application, but take notice that^/api/.*$
is among the ignored routes, allowing your Google App Engine Endpoints to function properly.When setting up the filter (default in web.xml), it is very useful to increase the default log level so you can look at what requests gets rewritten in the console: