App platform HTTP Request Routes Wildcard re-writes
S
Sérgio Isidoro
At the moment, serving static SPA React app with react router via CDN works as long as the user reaches the app through the root url.
If the user reloads a certain current URL, however, it will display a 404. To fix this we can add a request url re-write such that
/some/path/
would be replaced by /
However adding all those edpoints one by one is impossible, especially if there are url parameters used by that app.
Vercel allows this, for example, by specifying rewrites with wildcards
{
"rewrites": [
{"source": "/(.*)", "destination": "/"}
]
}
This is not possible in DO, prevents us from using App platform to serve our frontend app via CDN
S
Sérgio Isidoro
Related: https://ideas.digitalocean.com/app-platform/p/url-rewrites-for-app-platform-sites