Some endpoints throw `Internal Server Error` when missing the trailing slash in the URL
Very likely related to https://github.com/PokeAPI/pokeapi/issues/1286, almost identical symtoms just different responses and the trailing slash issue swapped the other way around. I'm unsure when this new error has started, since I took a break from working with the API, but it's possibly related to https://github.com/desophos/pokeapi-scala/commit/59c6f556b7259ec4c0f3270a38ceaa77321faf91, since that touched the cache behavior? Unsure, I haven't dug into this at all besides checking with curl
Steps to Reproduce:
- Visit
https://pokeapi.co/api/v2/pokemon/25and seeInternal Server Error - Visit
https://pokeapi.co/api/v2/pokemon/25/and see data
curl requests like before:
curl -I https://pokeapi.co/api/v2/pokemon/25
HTTP/2 500
date: Mon, 24 Nov 2025 00:37:18 GMT
content-type: text/plain; charset=utf-8
access-control-allow-origin: *
cache-control: public, max-age=432000, s-maxage=432000
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=neWNrQ4yoD1L4sFif7AX39MvS87zzUpny2A1OXfwy4smi6kyEtVnyy8ewymwt8%2FSIK6R%2Fi2NVV3F2Qwaf%2FfxQKFrOpdtY6KeEl2ae5Kxwow50a7b"}]}
etag: W/"15-/6VXivhc2MKdLfIkLcUE47K6aH0"
function-execution-id: 0oylb0bx3ruk
server: cloudflare
x-cloud-trace-context: 1be6cf1a786780c2b6968f656a9e53c7
x-powered-by: Express
fastly-restarts: 1
x-served-by: cache-lga21976-LGA
x-cache: MISS
x-cache-hits: 0
x-timer: S1763468950.406089,VS0,VE2684
vary: Accept-Encoding, x-fh-requested-host, accept-encoding
alt-svc: h3=":443"; ma=86400
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
age: 372737
cf-cache-status: HIT
cf-ray: 9a34d6453fab32f5-JAX
curl -I https://pokeapi.co/api/v2/pokemon-species/25/
HTTP/2 200
date: Mon, 24 Nov 2025 00:36:21 GMT
content-type: application/json; charset=utf-8
access-control-allow-origin: *
cache-control: public, max-age=86400, s-maxage=86400
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
etag: W/"b6e5-ybPGrKPeCiJaxD9jTUOLFEgHcwE"
function-execution-id: iv5awlevrjru
server: cloudflare
strict-transport-security: max-age=31556926
x-cloud-trace-context: c876146e8a4d6bf3e5c7edb16a0e5c41
x-country-code: US
x-orig-accept-language: en-US,en;q=0.9
x-powered-by: Express
x-served-by: cache-chi-kigq8000086-CHI
x-cache: HIT
x-cache-hits: 0
x-timer: S1761095439.038515,VS0,VE12
vary: Accept-Encoding,cookie,need-authorization, x-fh-requested-host, accept-encoding
alt-svc: h3=":443"; ma=86400
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=VsEY5HDHCxactavF19yJT0cSgnD78FHVNJQuJpu%2Ft%2B0joDp9fvH003M3M6Jsj0iWFRG2wFfiUVqq6tL4lyigxrVed4NMiC%2FDombacABA6MOutuAf"}]}
cf-cache-status: HIT
cf-ray: 9a34d4e09e9d68ca-JAX
Hi I get 200 for those URLs.
I'll try to purge the cache tomorrow
I don't think this is a caching issue. If you check my curl output, you'll see that when I get a 500 error it's a cache miss, which means the request is hitting the origin server. It's not serving a cached response, so clearing the cache likely won't do anything here
If anything clearing the cache might make things worse, since I suspect that the reason why you're getting a 200 is because you're getting a cached response that's valid (which also lines up with my tests)
This issue seems to originate from the origin server and I fear that clearing the cache might cause the issue to occur for more people, since good caches will be deleted and the requests will hit the origin server, which is when the 500 error occurs
I'm not sure. By looking at the header cf-cache-status: HIT in your 500 I suspect it's still CF that serves it. Still you're right about the 500 being originated from the origin server (GCP function)
You're right, I hadn't noticed that there's multiple cache headers here. Cloudflare is saying it's a HIT, but whatever cache-lga21976-LGA is is saying it's a MISS:
x-served-by: cache-lga21976-LGA
x-cache: MISS
x-cache-hits: 0
Hi, does the error still occur? 10 days have passed and the cache should have been invalidated, cloudflare-side