Welcome! Log In Create A New Profile

Advanced

Re: nginx returns html instead of json response

All files from this thread

File Name File Size   Posted by Date  
nginxtest.conf 3.6 KB open | download kaushalshriyan 11/07/2022 Read message
nginxtest.conf 3.6 KB open | download kaushalshriyan 11/08/2022 Read message
nginxtest.conf 3.6 KB open | download kaushalshriyan 11/09/2022 Read message
nginxtest.conf 3.6 KB open | download kaushalshriyan 11/14/2022 Read message
nginxtest.conf 3.6 KB open | download kaushalshriyan 11/22/2022 Read message
Francis Daly
November 17, 2022 12:28PM
On Mon, Nov 14, 2022 at 08:24:15PM +0530, Kaushal Shriyan wrote:
> > On Fri, Nov 11, 2022 at 2:38 PM Francis Daly <francis@daoine.org> wrote:

Hi there,

> >> What one specific request do you want to make? (Maybe
> >> http://mydomain.com/apis, maybe http://mydomain.com/api/v1/*, maybe
> >> http://mydomain.com/api/v1/example, maybe something else?)
> >>
> >> For that one specific request, what do you want nginx to do with
> >> it? (Maybe make a http request to the Drupal system? Or a fastcgi request
> >> to the Drupal system? Or handle it internally withint nginx?)
> >>
> >> For the response from that request, what do you want nginx to do with
> >> it? (Send it to the user as-is? Mangle / modify it somehow? If so --
> >> how? Change the http response code or headers? Change the response body?)

> So I think, if somehow we can pass the information to Nginx to not take any
> action if 500 error occurred while hitting the
> https://mydrupalsite.com/apis or https://mydrupalsite.com/apis/uinque_id
> URLs then our job will done, because in that case whatever Drupal is
> sending we will be able to see that if 500 error occurred.

Correct.

You will want a location{} to handle the "api" requests; and in that
location, do not have the inherited "error_page 500" directive take effect.

I think that you cannot "undo" an error_page directive from a previous
level, but you can set a "dummy" error_page directive which will have
the effect of overriding any values set at a previous level. So --
pick a http response code that you do not care about (e.g. 555) and set
error_page for that in this location.


From your config, it looks like there are three forms of "non-api"
requests that matter:

* /one/file.html - which will return the local file
/var/www/html/gsmamarketplace/web/one/file.html

* /two/file.php - which will ask drupal to use the local file
/var/www/html/gsmamarketplace/web/two/file.php

* /three/not-a-file - which will ask drupal to use the local file
/var/www/html/gsmamarketplace/web/index.php


What forms of "api" request do you expect to receive? And what,
specifically, do you want nginx to do with each form?

That is -- do you expect "/apis/one/file.html", or "/apis/two/file.php",
or "/apis/three/not-a-file", or some of each, or something else?

When the request is for "/apis/unique_id", what file on the filesystem
do you want nginx to serve; or what file on the filesystem do you want
nginx to ask drupal to use?

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

nginx returns html instead of json response

kaushalshriyan November 07, 2022 10:32AM

Re: nginx returns html instead of json response

Dan G. Switzer, II November 07, 2022 11:10AM

Re: nginx returns html instead of json response Attachments

kaushalshriyan November 07, 2022 12:48PM

Re: nginx returns html instead of json response

Dan G. Switzer, II November 07, 2022 01:22PM

Re: nginx returns html instead of json response

Maxim Dounin November 08, 2022 12:50AM

Re: nginx returns html instead of json response Attachments

kaushalshriyan November 08, 2022 02:56AM

Re: nginx returns html instead of json response Attachments

kaushalshriyan November 09, 2022 01:16PM

Re: nginx returns html instead of json response

Francis Daly November 11, 2022 04:08AM

Re: nginx returns html instead of json response

kaushalshriyan November 11, 2022 05:52AM

Re: nginx returns html instead of json response Attachments

kaushalshriyan November 14, 2022 09:56AM

Re: nginx returns html instead of json response

kaushalshriyan November 16, 2022 12:00PM

Re: nginx returns html instead of json response

Sergey A. Osokin November 16, 2022 04:42PM

Re: nginx returns html instead of json response

kaushalshriyan November 16, 2022 08:20PM

Re: nginx returns html instead of json response

Francis Daly November 17, 2022 12:28PM

Re: nginx returns html instead of json response

kaushalshriyan November 18, 2022 08:40AM

Re: nginx returns html instead of json response

Francis Daly November 18, 2022 11:06AM

Re: nginx returns html instead of json response

kaushalshriyan November 18, 2022 12:42PM

Re: nginx returns html instead of json response

Francis Daly November 18, 2022 01:32PM

Re: nginx returns html instead of json response

kaushalshriyan November 19, 2022 10:42AM

Re: nginx returns html instead of json response

Francis Daly November 21, 2022 02:22PM

Re: nginx returns html instead of json response Attachments

kaushalshriyan November 22, 2022 09:24AM

Re: nginx returns html instead of json response

Francis Daly November 23, 2022 12:50PM

Re: nginx returns html instead of json response

kaushalshriyan November 23, 2022 12:58PM

Re: nginx returns html instead of json response

Francis Daly November 23, 2022 01:10PM

Re: nginx returns html instead of json response

kaushalshriyan November 29, 2022 11:30AM

Re: nginx returns html instead of json response

kaushalshriyan November 30, 2022 12:48PM

Re: nginx returns html instead of json response

Francis Daly December 01, 2022 02:48PM

Re: nginx returns html instead of json response

kaushalshriyan November 23, 2022 12:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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