element-hq / element-hq/synapse
Synapse responds 204 to `OPTIONS` regardless of the endpoint actually existing
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 46
Description
### Description
When Synapse is approached with an `OPTIONS` request, it responds 204, always. It should be returning `404 M_UNRECOGNIZED` for endpoints which don't exist at all, and `405 M_UNRECOGNIZED` for non-client-server endpoints which do exist, as per the `M_UNRECOGNIZED` description at https://spec.matrix.org/v1.10/client-server-api/#common-error-codes
Synapse's current behaviour can cause endpoint discovery to be unreliable. For example, https://github.com/matrix-org/matrix-react-sdk/pull/12492 aims to use `OPTIONS` to discover sliding sync, but because Synapse *always* returns a success code, the react-sdk thinks sliding sync is supported (even though it's not, as of writing).
### Steps to reproduce
* `curl -sv -X OPTIONS https://matrix-client.matrix.org/_matrix/client/this/path/does/not/exist`
### Homeserver
all
### Synapse Version
at least 1.105.1
### Installation Method
Other (please mention below)
### Database
n/a
### Workers
I don't know
### Platform
n/a
### Configuration
_No response_
### Relevant log output
```shell
n/a
```
### Anything else that would be useful to know?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.