# Why does Azure APIM return 404 instead of 405 for a valid path with the wrong HTTP method? — retained record

> Retained reddit record from reddit:AZURE.

Canonical: https://highsignal.app/data/records/f0a285acce94ced0

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:AZURE)  published 2026-09-02 17:40 ingested 2026-09-03 02:42

[original source ↗](https://www.reddit.com/r/AZURE/comments/1w5hcjb/why_does_azure_apim_return_404_instead_of_405_for/)

## retained text



```
Maybe I'm missing something here, but this seems like really strange behavior from APIM.

Say I have this operation defined:

`POST /api/example`

If I call:

`GET /api/example`

APIM returns `404 Not Found`.

But the resource/path clearly exists. The method is what's wrong. Isn't this exactly what `405 Method Not Allowed` is for?

I'd expect:

* `GET /api/does-not-exist` → `404 Not Found`
* `GET /api/example` when only POST exists → `405 Method Not Allowed`
* Ideally with `Allow: POST`

This isn't just academic either. We're using APIM gateway logs for troubleshooting, and now a 404 can mean either "you have the wrong URL" or "you have the right URL but the wrong verb." That makes troubleshooting unnecessarily ambiguous.

Is there some architectural reason APIM handles operation matching this way? Is there a setting I'm missing, or does APIM genuinely treat method + path as a single lookup and return 404 whenever that combination doesn't exist?

If that's intentional behavior... why? It seems to defeat the purpose of HTTP 405.
```



document fetched 2026-09-03 00:39 · canonical https://reddit.com/r/AZURE/comments/1w5hcjb/why_does_azure_apim_return_404_instead_of_405_for
