Skip to content

Preflight OPTIONS Requests #7

@XMB5

Description

@XMB5

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions