instedd / surveda

InSTEDD Surveda
https://instedd.org/technologies/surveda-mobile-surveys/
GNU General Public License v3.0
16 stars 6 forks source link

Invalid public links should return a 404 error #2345

Open matiasgarciaisaia opened 1 month ago

matiasgarciaisaia commented 1 month ago

Surveda's public links are yielding 500 Internal Server Error responses for inexsitent links:

$ curl -I https://surveda.instedd.org/link/this-does-not-exist
HTTP/1.1 500 Internal Server Error
cache-control: max-age=0, private, must-revalidate
content-length: 42
content-type: text/html; charset=utf-8
date: Thu, 30 May 2024 21:40:23 GMT
server: Cowboy
strict-transport-security: max-age=31536000
x-request-id: F9RiGqQ7LAwDyGYACMJB

The response's body says There was an error. Please try again later.

It should actually return a 404 error saying the link does not exist if it's not found in the DB.

This could help avoid automations keep retrying to fetch the same links over and over again.