I'm developing an application using react js and nodejs.When I run the application in local machine it works properly as a example
localhost:3000/AboutUs
localhost:3000
When I refresh the above URLs, it shows the correct web page. I deploy this application in Google App Engine and when I refresh the below page it shows that the requested URL was not found. Can any one let me know the reason for this?
www.mydomain.com/AboutUs
app.yaml code is as below
runtime: nodejs8
handlers:
- url: /api/.*
# secure: always
# redirect_http_response_code: 301
script: auto
- url: /
static_files: build/index.html
upload: build/index.html
It's because you don't have a defined handler to direct your /AboutUs
URL. You can either add, under handlers
:
- url: /AboutUs
script: auto
Or add a wildcard handler at the end of the url list, for example:
runtime: nodejs8
handlers:
- url: /api/.*
# secure: always
# redirect_http_response_code: 301
script: auto
- url: /
static_files: build/index.html
upload: build/index.html
- url: /.*
script: auto
It's important to keep the wildcard handler /.*
at the end, since otherwise all the URL's will fall under it, and it won't use the other url handlers.
Also you had two spaces missing in the script
, static_files
and upload
tags under the url's, I don't know if it was because of the formatting when copying the app.yaml
contents to your answer, but either way, indentation is important in YAML files.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.