I have a GAE application in java standard environment for the backend and angular 4.0 for the frontend.
The app works fine locally, but when deployed, I get a 404 error when refreshing or when trying to type the url of the desired page.
I understand that I have got to define a routing fallback as described in the angular documentation in order to redirect every unknown request to my index.html.
As I understand it from many stackoverflow GAE appengine python questions, the solution consists of configuring the app.yaml file.
Ok, but how? In the app engine standard environment, the app.yaml file is auto-generated in the staging folder as follow, but everything happens under the hood when I deploy with the google plugin for eclipse and I have no access to it.
runtime: java7
inbound_services:
- warmup
derived_file_type:
- java_precompiled
threadsafe: True
auto_id_policy: default
api_version: '1.0'
handlers:
- url: (/.*/)
static_files: __static__\1index.html
upload: __NOT_USED__
require_matching_file: True
login: optional
secure: optional
- url: (/)
static_files: __static__\1index.html
upload: __NOT_USED__
require_matching_file: True
login: optional
secure: optional
- url: (/.*)
static_files: __static__\1
upload: __NOT_USED__
require_matching_file: True
login: optional
secure: optional
- url: /.*
script: unused
login: optional
secure: optional
Can someone tell me if there is a way to edit the app.yaml file before deploying in the appengine java standard environment. A similar question has been posted recently but there is no response for the moment.
I think you're confusing angular routing, which happens on the browser side, from the server-side URL routing, which is described by a
web.xml
.My guess is that your
web.xml
is missing a welcome file to load theindex.html
. For example, here's a simpleweb.xml
that should do the trick: