<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 17, 2022 at 10:57 PM Francis Daly <<a href="mailto:francis@daoine.org">francis@daoine.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Nov 14, 2022 at 08:24:15PM +0530, Kaushal Shriyan wrote:<br>
> > On Fri, Nov 11, 2022 at 2:38 PM Francis Daly <<a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a>> wrote:<br>
<br>
Hi there,<br>
<br>
> >> What one specific request do you want to make? (Maybe<br>
> >> <a href="http://mydomain.com/apis" rel="noreferrer" target="_blank">http://mydomain.com/apis</a>, maybe <a href="http://mydomain.com/api/v1/*" rel="noreferrer" target="_blank">http://mydomain.com/api/v1/*</a>, maybe<br>
> >> <a href="http://mydomain.com/api/v1/example" rel="noreferrer" target="_blank">http://mydomain.com/api/v1/example</a>, maybe something else?)<br>
> >><br>
> >> For that one specific request, what do you want nginx to do with<br>
> >> it? (Maybe make a http request to the Drupal system? Or a fastcgi request<br>
> >> to the Drupal system? Or handle it internally withint nginx?)<br>
> >><br>
> >> For the response from that request, what do you want nginx to do with<br>
> >> it? (Send it to the user as-is? Mangle / modify it somehow? If so --<br>
> >> how? Change the http response code or headers? Change the response body?)<br>
<br>
> So I think, if somehow we can pass the information to Nginx to not take any<br>
> action if 500 error occurred while hitting the<br>
> <a href="https://mydrupalsite.com/apis" rel="noreferrer" target="_blank">https://mydrupalsite.com/apis</a> or  <a href="https://mydrupalsite.com/apis/uinque_id" rel="noreferrer" target="_blank">https://mydrupalsite.com/apis/uinque_id</a><br>
>  URLs then our job will done, because in that case whatever Drupal is<br>
> sending we will be able to see that if 500 error occurred.<br>
<br>
Correct.<br>
<br>
You will want a location{} to handle the "api" requests; and in that<br>
location, do not have the inherited "error_page 500" directive take effect.<br>
<br>
I think that you cannot "undo" an error_page directive from a previous<br>
level, but you can set a "dummy" error_page directive which will have<br>
the effect of overriding any values set at a previous level. So --<br>
pick a http response code that you do not care about (e.g. 555) and set<br>
error_page for that in this location.<br>
<br>
<br>
>From your config, it looks like there are three forms of "non-api"<br>
requests that matter:<br>
<br>
* /one/file.html - which will return the local file<br>
/var/www/html/gsmamarketplace/web/one/file.html<br>
<br>
* /two/file.php - which will ask drupal to use the local file<br>
/var/www/html/gsmamarketplace/web/two/file.php<br>
<br>
* /three/not-a-file - which will ask drupal to use the local file<br>
/var/www/html/gsmamarketplace/web/index.php<br>
<br>
<br>
What forms of "api" request do you expect to receive? And what,<br>
specifically, do you want nginx to do with each form?<br>
<br>
That is -- do you expect "/apis/one/file.html", or "/apis/two/file.php",<br>
or "/apis/three/not-a-file", or some of each, or something else?<br>
<br>
When the request is for "/apis/unique_id", what file on the filesystem<br>
do you want nginx to serve; or what file on the filesystem do you want<br>
nginx to ask drupal to use?<br>
<br>
Cheers,<br>
<br>
        f<br>
-- <br>
Francis Daly        <a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a><br>
_______________________________________________<br>
nginx mailing list -- <a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
To unsubscribe send an email to <a href="mailto:nginx-leave@nginx.org" target="_blank">nginx-leave@nginx.org</a></blockquote><div><br></div><div><br></div><div>Thanks Francis for the detailed explanation. </div><div><br></div>Overriding the nginx 500 error message will not be a solution for us as we are handling 500 errors in Drupal codebase, and 500 errors can occur in any file of the codebase, at code level we are handling that and sending the json response. So incase of, ' /apis ' call or .'apis/unique_id' call if nginx web server does nothing, then by default the JSON response whatever Drupal CMS (<a href="https://www.drupal.org/">https://www.drupal.org/</a>) sends will be displayed to the user and this will solve our problem.<br><br>We can not have a dedicated page (either php or html) to display the response as 500 error messages can occur from any random file of the codebase. Whenever the 500 error occurs, Drupal CMS (<a href="https://www.drupal.org/">https://www.drupal.org/</a>) will return a JSON response and that JSON response content can be different based on the cause of the issue.<br><br><div>For example <a href="https://mydrupalsite.com/apis">https://mydrupalsite.com/apis</a> and <a href="https://mydrupalsite.com/apis/uinque_id">https://mydrupalsite.com/apis/uinque_id</a> for these two page hits, even if 500 error occurred we do not want nginx to show the default HTML 500 error page. In short we want nginx webserver to do nothing and not consider these two pages while showing 500 errors. </div><div><br></div><div><div><div>Please let me know if you need any additional information and I look forward to hearing from you. Thanks in advance. </div></div><div><br></div><div>Best Regards,</div><div><br></div><div>Kaushal </div></div></div></div>