0

When running my Angular app locally I can go to for example localhost:4200/login. When I deploy my Angular app however when I go to website.com/login, I get "The requested URL /login was not found on this server". My app is deployed to a Google Cloud appengine.

When I add "useHash: true" to my RouterModule. It works fine, so website.com/#/login works, however this seems counterintuitive since when someone would fill in the url themselves I would assume that they would fill in website.com/login, which would redirect them again to the not found on this server.

How can I avoid using this "useHash:true" and have my routing the same as being locally?

2
  • have you tried solutions mentioned in this ans stackoverflow.com/questions/43535048/… Commented Apr 11, 2020 at 22:03
  • Tried all solutions mentioned there. Also deleted cache every re-upload, nothing worked. The only thing that works is when I leave "useHash: true" in it. Commented Apr 12, 2020 at 14:24

1 Answer 1

2

I assume your app.yaml would look something like this:

handlers:
  - url: /
    upload: /index.html
    static_files: /index.html
    secure: always

now when you try to open the URL /login/, there's no route for it in app.yaml, which is why it returns you 404. So the useHash directive is the only solution you have here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.