Forum Moderators: phranque
window.location.replace("/api/404-error-page"); since the app routing is handled client side if I return a "page not found" page the server still responds with a 200 status.
how would a client directly request such a url[?]
example.com/php-login since the app routing is handled client side if I return a "page not found" page the server still responds with a 200 status.
So to solve the problem what I have done is to use a JS redirect that redirects the page to an endpoint to which only the server responds to directly.
The problem being that the request returns a 200 response despite the fact that it doesn't exist, which wastes resources and potentially sends them a signal to come back and poke some more.
I suppose the ideal setup would be to provide nginx with an explicit list of allowable routes and anything else would return a 404.
googlebot/bingbot/etc will not only have to request your SPA but will also have to render the javascript before it knows about the redirect,
so do i.
location @proxy_to_app {
... set a few headers ...
proxy_pass http://127.0.0.1: port to node server
}
location /api {
... set a few more headers ...
proxy_pass http://127.0.0.1: port to python server
}