craftcms / element-api

Create a JSON API/Feed for your elements in Craft.
MIT License
498 stars 56 forks source link

Google tried indexing element api URl #124

Closed piotrpog closed 2 years ago

piotrpog commented 4 years ago

I have element API endpoint which requires specific URL attributes to work.

If I enter directly endpoint URL in the browser, it returns error and error code 500:

{"error":{"code":2,"message":"Invalid argument supplied for foreach()"}}

This is expected behavior, but for some reason, google search console started including endpoint URL in its report. It didnt indexed that site, but showed error:

Server error (5xx)

Maybe there should be some additional HTTP header in such situation that would block google?

brandonkelly commented 2 years ago

Just released Element API 2.8.0 which sets X-Robots-Tag: none headers on all API endpoint responses, so this shouldn’t happen anymore.