Element API Endpoint returns data but has 404 header The url: https://www.fira.co.uk/fullmembers.json

is an endpoint for Craft's element API plugin.

It has been working fine until recently I did a few things:


I changed the site to https
There have been some tweaks to the server config (nginx caching etc)


The problem I am having is that the URL returns a 404 header but still displays the JSON response in the browser. This 404 is affecting my wget script that systematically saves the response to a static file, as to improve performance.

Any ideas why the endpoint would be behaving like this?

I haven't altered the elementapi.php recently but here it is:

&lt;?php
namespace Craft;

return [
    'endpoints' =&gt; [
        'fullmembers.json' =&gt; [
            'elementType' =&gt; 'User',
            'criteria' =&gt; ['group' =&gt; 'fullMembership', 'limit' =&gt; null, 'order' =&gt; 'companyName'],
            'paginate' =&gt; false,
            'transformer' =&gt; function(UserModel $member) {
                // var_dump($member-&gt;memberAddress);
                $businessCategories = [];
                foreach ($member-&gt;businessTypeMarketSectorsProducts as $block) {
                    switch ($block-&gt;type-&gt;handle) {
                        case 'businessCategory':

                        $productValues = [];
                        foreach ($block-&gt;product as $prod) {
                            if ($prod-&gt;selected) {
                                $productValues[] = $prod-&gt;value;
                            }
                        }

                        $businessCategories[] = [
                            'businessType' =&gt; $block-&gt;businessType-&gt;value,
                            'marketSector' =&gt; $block-&gt;marketSector-&gt;value,
                            'product' =&gt; $productValues
                        ];

                        break;
                    }
                }
                // $urlslug = strtolower(implode('-',explode(" ", $member-&gt;membersCompanyName)));
                $urlslug = StringHelper::toKebabCase($member-&gt;membersCompanyName);

                return [
                    'id' =&gt; $member-&gt;id,
                    'companyName' =&gt; $member-&gt;membersCompanyName,
                    // 'memberAddress' =&gt; $member-&gt;memberAddress-&gt;attributes,
                    'lat' =&gt; $member-&gt;memberAddress-&gt;lat,
                    'lng' =&gt; $member-&gt;memberAddress-&gt;lng,
                    'city' =&gt; $member-&gt;memberAddress-&gt;city,
                    'street1' =&gt; $member-&gt;memberAddress-&gt;street1,
                    'street2' =&gt; $member-&gt;memberAddress-&gt;street2,
                    'street3' =&gt; $member-&gt;membersAddressLine3,
                    'zip' =&gt; $member-&gt;memberAddress-&gt;zip,
                    'country' =&gt; $member-&gt;memberAddress-&gt;country,
                    'email' =&gt; $member-&gt;email,
                    'phone' =&gt; $member-&gt;membersPhoneNumber,
                    'profile' =&gt; UrlHelper::getUrl("directory/company/{$member-&gt;id}/{$urlslug}"),
                    'businessCategories' =&gt; $businessCategories
                ];
            },
        ]
    ]
];
Removing this from my site's nginx conf fixed it:

location ~* \.(?:manifest|appcache|html?|xml|json)$ {
 expires -1;
}


However, what I really want to do is cache stuff, without breaking this endpoint