I have a custom domain with a route that I'd like to map to my React application (create-react-app production build being served on App engine). When I map the custom domain, none of my static files are found however. I've tried updating the handlers for the app but I'm getting the same error (404 on loading css, js, manifest). My dispatch.yaml
is
dispatch:
- url: "example.service.org/test"
service: my-service
Accessing example.service.org/test
correctly populates the page title but none of the assets load. How do I update my handlers to serve the files correctly?
If this is working in your appspot.com domain means that your static routes works fine.
I think that the issue is caused because your service doesn't know how to address this path
/test/static
I think that are multiple solutions to this issue:
1.- Map the domain with the service without /test
dispatch:
- url: "example.service.org"
service: my-service
with this workaround if you need a test url you can add an test subdomain in order to have 2 services one in prod and another in dev/test for example
dispatch:
- url: "example.service.org"
service: my-service
- url: "test.example.service.org"
service: test-my-service
2.- define in your app.yaml this handlers
handlers:
- url: /static
static_dir: static/
- url: /test/static
static_dir: static/
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.