Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preflight OPTIONS Requests #7

Open
XMB5 opened this issue May 14, 2018 · 0 comments
Open

Preflight OPTIONS Requests #7

XMB5 opened this issue May 14, 2018 · 0 comments

Comments

@XMB5
Copy link

XMB5 commented May 14, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant