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

2016-08-08 Thread Edho Arief
Hi, On Tue, Aug 9, 2016, at 01:59, msonntag wrote: > Hi Edho, > > > If going so far to hit api server anyway, why not proxy all requests > > (except assets) and serve the index page if 200 and request type is > > html? nginx then can intercept errors and return correct html error > >page. > >

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

2016-08-08 Thread msonntag
Hi Edho, > If going so far to hit api server anyway, why not proxy all requests > (except assets) and serve the index page if 200 and request type is > html? nginx then can intercept errors and return correct html error >page. Yes, that would be possible. But – if I understand you correctly –

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

2016-08-08 Thread Edho Arief
Hi, On Tue, Aug 9, 2016, at 00:07, msonntag wrote: > 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

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

2016-08-08 Thread msonntag
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

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

2016-08-08 Thread B.R.
Sending 404 allows providing body content, and displaying beautiful pages is not restricted to 200. Thus, I do not get the 200 status sent to clients. My suggestion would be sending the same HTTP status code to everyone, choosing the most semantically correct in doing so. We are drifting away

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

2016-08-08 Thread msonntag
Hey B. R., Thanks for your reply! I will have a look at the provided resources. As per your comment: > I find it strange you oppose HTTP 404 with 'a proper status code': 404 is a 'proper' status code. > I find it even stranger you want to lie to search engines crawlers about the existence of

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

2016-08-08 Thread B.R.
I find it strange you oppose HTTP 404 with 'a proper status code': 404 is a 'proper' status code. I find it even stranger you want to lie to search engines crawlers about the existence of your resource. That said, you can craft/modify upstream requests in the proxy module with directives such as:

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

2016-08-08 Thread msonntag
Hello, I have the following scenario: - Client: AngularJS-based SPA running on www.example.com - Backend: API running on api.example.com Both live in one nginx instance in two separate "server" environments. - Browsing to www.example.com/items/1 launches the Angular app - App sends request to