Missing `Access-Control-Max-Age` Header in HTTP Responses Causes Performance Issues

Aperta
#2,161 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 11 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Ambito
api, performance

Direzione di ricerca

L’issue riguarda le risposte dell’HTTP API e gli header CORS allow-* esistenti; inizia individuando dove vengono emessi questi header. Verifica il completamento confermando che le risposte includano Access-Control-Max-Age: 86400 e che i risultati del preflight del browser possano essere memorizzati nella cache.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description:

Version Information:

  • Version: 0.24.32
  • Commit SHA: a57ad4a2742c1cefb25d3288b33ed25c6570e0d2
  • Build Date: 2025-09-09

Problem:
The current HTTP API responses include the following headers for Cross-Origin Resource Sharing (CORS):

  • access-control-allow-headers: *
  • access-control-allow-methods: *
  • access-control-allow-origin: *

However, the Access-Control-Max-Age header is missing. This header is crucial for performance as it tells browsers how long they can cache the results of a CORS preflight request.

Without this header, the browser is forced to send a preflight OPTIONS request before every actual HTTP request to check if the CORS protocol is understood and the request is safe to send. This results in unnecessary, repetitive preflight requests, which significantly degrades the performance of front-end applications.

Suggestion:
It is recommended to add the Access-Control-Max-Age header to the HTTP responses. A suggested value is 86400 seconds (24 hours), which is the maximum value supported by Firefox.

Example:
Access-Control-Max-Age: 86400

Adding this header will allow browsers to cache the preflight response, eliminating the need for repeated OPTIONS requests and improving the overall performance and responsiveness of the front-end.

Image
Lingua principale
C
Stelle
17.3k
Fork
562
Merge medio
10g 15h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tursodatabase/libsql

Tutte le issue di tursodatabase/libsql

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.