Welcome! Log In Create A New Profile

Advanced

Re: Return proper status codes (404, 302) from client-side Single Page Application

August 08, 2016 11:07AM
Hey B. R.,

Thanks for getting back to me. I am pretty sure that I was not able to make my point very clear.

The main point is that a client accessing www.example.com/items/1 is simply delivered a HTML file bootstrapping an AngularJS app. The JS client will then make a separate request to api.example.com/items/1 to fetch the data. At this point, if the API returns a 404, there is no way to send a 404 for the initial request, as the response was already sent. So my idea was to make a "precheck" request via nginx to check the item's existence prior to delivering the HTML file containing the JS client. Another way would be to have the server-side application deliver the client bootstrapping file, but that's not the way the architecture is currently set up.

Don't know if that makes sense. Looking at the documentation links you provided, I do not really know what you are suggesting as a solution.

Maybe these SO questions are able to explain it better?!

http://stackoverflow.com/questions/35989950/how-to-notify-googlebot-about-404-pages-in-angular-spa
http://stackoverflow.com/questions/37334220/how-do-i-return-a-http-404-status-code-from-a-spa
http://stackoverflow.com/questions/14779190/in-a-single-page-app-what-is-the-right-way-to-deal-with-wrong-urls-404-errors

Thanks again for your input.
Subject Author Posted

Return proper status codes (404, 302) from client-side Single Page Application

msonntag August 08, 2016 05:50AM

Re: Return proper status codes (404, 302) from client-side Single Page Application

B.R. August 08, 2016 06:06AM

Re: Return proper status codes (404, 302) from client-side Single Page Application

msonntag August 08, 2016 06:15AM

Re: Return proper status codes (404, 302) from client-side Single Page Application

B.R. August 08, 2016 10:44AM

Re: Return proper status codes (404, 302) from client-side Single Page Application

msonntag August 08, 2016 11:07AM

Re: Return proper status codes (404, 302) from client-side Single Page Application

Edho Arief August 08, 2016 11:18AM

Re: Return proper status codes (404, 302) from client-side Single Page Application

msonntag August 08, 2016 12:59PM

Re: Return proper status codes (404, 302) from client-side Single Page Application

Edho Arief August 08, 2016 01:04PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 292
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready