Welcome! Log In Create A New Profile

Advanced

Re: Return JSON for 404 error instead of html

Justin Dorfman
May 13, 2014 11:50AM
Out of curiosity, would the mime/content type show up as application/json
or text/plain?


Regards,

Justin Dorfman http://www.twitter.com/jdorfman

Director of Developer Relations
MaxCDN http://twitter.com/MaxCDNDeveloper

Email / IM: jdorfman@maxcdn.com
Mobile: 818.485.1458
Twitter: @jdorfman http://www.twitter.com/jdorfman


On Tue, May 13, 2014 at 7:37 AM, Valentin V. Bartenev <vbart@nginx.com>wrote:

> On Tuesday 13 May 2014 15:30:56 B.R. wrote:
> > > Instead of using 3rd-party echo module, you can utilize the return
> > > directive
> > >
> > > for the same purpose:
> > > return 200 '{"status": "Not Found"}';
> > >
> > > Reference: http://nginx.org/r/return
> > >
> > > wbr, Valentin V. Bartenev
> >
> > ​I would have intuitively written code 404 rather than 200 on this one
> > since the aim is to send a 404 error answer.​
> > Am I wrong? Would that loop?
> >
>
> I wrote an equivalent of "echo". The logic is that in this handler we
> provide
> the page for 404 which actually exists.
>
> wbr, Valentin V. Bartenev
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Return JSON for 404 error instead of html

justink101 May 13, 2014 12:08AM

Re: Return JSON for 404 error instead of html

Lord Nynex May 13, 2014 02:44AM

Re: Return JSON for 404 error instead of html

Matthias Rieber May 13, 2014 04:46AM

Re: Return JSON for 404 error instead of html

justink101 May 14, 2014 06:38PM

Re: Return JSON for 404 error instead of html

Francis Daly May 15, 2014 03:20AM

Re: Return JSON for 404 error instead of html

Valentin V. Bartenev May 13, 2014 05:02AM

Re: Return JSON for 404 error instead of html

B.R. May 13, 2014 09:32AM

Re: Return JSON for 404 error instead of html

Valentin V. Bartenev May 13, 2014 10:38AM

Re: Return JSON for 404 error instead of html

Justin Dorfman May 13, 2014 11:50AM

Re: Return JSON for 404 error instead of html

Valentin V. Bartenev May 13, 2014 11:54AM

Re: Return JSON for 404 error instead of html

Justin Dorfman May 13, 2014 12:08PM

Re: Return JSON for 404 error instead of html

B.R. May 13, 2014 03:18PM

Re: Return JSON for 404 error instead of html

Francis Daly May 13, 2014 04:16PM

Re: Return JSON for 404 error instead of html

B.R. May 13, 2014 08:54PM

Re: Return JSON for 404 error instead of html

justink101 May 14, 2014 05:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 309
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