-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Almost every request to thingboard is accompanied by a preflight OPTIONS request. This is slow and taxes the server. To lower the amount of preflight requests, set the following headers in the preflight response:
Access-Control-Max-Age: 86400
This allow caching of preflight requests for up to 1 day (chrome will cap this to 10 minutes)
Access-Control-Allow-Methods: GET, HEAD, POST, PUT, DELETE, OPTIONS
This allow caching of preflight requests for different HTTP methods. If a non-standard HTTP method is in Access-Control-Request-Method, add it to the list. Ideally, this header would have a wildcard (*) value, but some slightly outdated browsers don't support the wildcard.
Reference:
Preflight request
Access-Control-Max-Age
Access-Control-Allow-Methods
Access-Control-Request-Method