element-hq / element-hq/synapse

Send Access-Control-Max-Age header

Open
#9,669 0 comments 2 reactions 0 assignees View on GitHub
T-Enhancement
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#9669](https://github.com/matrix-org/synapse/issues/9669).

---

**Description:**

If synapse sent an Access-Control-Max-Age header with its CORS responses, user agents could cache the CORS response and wouldn't need to do an OPTIONS request for every single /sync request. Even caching for 60s could massively reduce the number of requests on a busy account, but it would probably make sense for it to be a config option.

Context: all C/S API requests need to be preflighted if they send the access token using the `Authorization` header (even GET requests) because `Authorization` is not in the standard set of allowed headers.

Contributor guide

Open the contributing guide

Research direction

Start by locating Synapse's CORS response handling for client-server API requests, then trace the /sync path and its OPTIONS preflight behavior. Define how Access-Control-Max-Age should be applied, including whether its value is configurable, and verify that browsers can cache the response without changing authorization behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.