Cache CORS preflight request

This commit is contained in:
cschwinne 2021-05-27 11:09:57 +02:00
parent c2892d7887
commit 55b26751ae

View File

@ -224,7 +224,10 @@ void initServer()
//make API CORS compatible //make API CORS compatible
if (request->method() == HTTP_OPTIONS) if (request->method() == HTTP_OPTIONS)
{ {
request->send(200); return; AsyncWebServerResponse *response = request->beginResponse(200);
response->addHeader(F("Access-Control-Max-Age"), F("7200"));
request->send(response);
return;
} }
if(handleSet(request, request->url())) return; if(handleSet(request, request->url())) return;