Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Send Access-Control-Max-Age header #9669

Open
dbkr opened this issue Mar 23, 2021 · 3 comments
Open

Send Access-Control-Max-Age header #9669

dbkr opened this issue Mar 23, 2021 · 3 comments
Labels
T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.

Comments

@dbkr
Copy link
Member

dbkr commented Mar 23, 2021

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.

@clokep clokep added the T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. label Mar 23, 2021
@timokoesters
Copy link

I just experimented with this in Conduit. It seems like the Access-Control-Max-Age header only allows caching if the query parameters of the request are the same too. This rarely happens with /sync because of the since parameter.

@richvdh
Copy link
Member

richvdh commented Mar 23, 2021

Related reading: https://github.com/matrix-org/matrix-doc/issues/785

@timokoesters
Copy link

I think this can be fixed while we add sliding syncs. I mentioned it here but did not get a response yet: matrix-org/matrix-spec-proposals#3575 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.
Projects
None yet
Development

No branches or pull requests

4 participants