Reputation: 25
I have an app.yaml file with this handelrs configuration:
handlers:
# Serve all static files with url ending with a file extension
- url: /(.*\..+)$
static_files: build/\1
upload: build/(.*\..+)$
# Catch all handler to index.html
- url: /.*
static_files: build/index.html
upload: build/index.html
My issue is that when I have an email address in the url, It tries to get it as a static file, which causes an 404 error. For example - mydomain.com/[email protected] This should be a regular route, not a static file. It's because of the dot in the emails. How can I configure the yaml differently to solve this?
Thanks in advance!
Upvotes: 1
Views: 418
Reputation: 39628
You need to come up with proper definition of what paths identify static files. Your current definition is broken because it matches mail addresses, which you do not want. This is not a YAML or RegEx problem, it is a specification problem.
A possible solution would be to say „if there's an @
symbol in the path, it is never a static file“. That would be rather easy to implement:
- url: /([^@]*\.[^@]+)$
A different solution would be to filter for known file extensions:
- url: /(.*\.(html|css|js|jpeg|gif|png))$
(add whatever extensions are relevant for you)
Upvotes: 1