nginx returns html instead of json response

Kaushal Shriyan kaushalshriyan at gmail.com
Sat Nov 19 15:39:34 UTC 2022


On Sat, Nov 19, 2022 at 12:02 AM Francis Daly <francis at daoine.org> wrote:

> On Fri, Nov 18, 2022 at 11:10:20PM +0530, Kaushal Shriyan wrote:
> > On Fri, Nov 18, 2022 at 9:37 PM Francis Daly <francis at daoine.org> wrote:
>
> Hi there,
>
> > Thanks Francis for your email response.  Let me explain with two
> different
> > scenarios :-
>
> Yes, thank you. I believe that what you want is still all clear to me,
> apart from the actual specific url patterns that you are using.
>
> I suspect that I am being unclear in the question that I am asking.
>
> Do you actually make an api request for exactly
> https://mydrupalsite.com/apis/unique_id? If so, what response do you get?
>
> And if you do not make an api request for exactly that url, can you show
> any one url that you do use when making an api request?
>
> What you will eventually want to add to your nginx config is something
> like
>
>         location ^~ /apis/ {
>                 error_page 555 /dummyfile;
>                 fastcgi_pass 127.0.0.1:9000;
>                 include fastcgi.conf;
>                 fastcgi_param SCRIPT_FILENAME something;
>         }
>
> but I am unable to guess what the "something" should be. Maybe it should
> always be "$document_root/index.php". And maybe different or other config
> is needed as well.
>
>
>

Hi Francis,

Yes we do api calls for those endpoints , for example - for this URL
https://mydrupalsite.com/apis, we have defined an API at Drupal end, and on
successful it return json response like below.
{
    "message": "API created successfully",
    "uuid": "9891655f-8174-4099-a471-321bee01fafd",
    "apiName": "sanity4 Automation_Payments_API_02_10_2022",
    "gbgf": "Wealth and Personal Banking (WPB)",
    "apiVersion": "1.0.0"
}
And for https://mydrupalsite.com/apis/unique_id also we have a specific API
call , on success which returns a JSON response like below.
{
    "message": "API updated successfully",
    "uuid": "9891655f-8174-4099-a471-321bee01fafd",
    "apiName": "TEST3TMETA-rbwm-200-sa-get-message-details-updated",
    "gbgf": "RBWM",
    "apiVersion": "1.0.0"
}
On 500 errors also we are handling at Drupal and sending JSON responses to
specify the details about errors.

Please let me know if you need any additional information and I look
forward to hearing from you. Thanks in advance.

Best Regards,

Kaushal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20221119/0b552df8/attachment.htm>


More information about the nginx mailing list