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

Due to API key being in header, all requests are pre-flighted, increasing latency #2

Open
corneliusroemer opened this issue Jan 13, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@corneliusroemer
Copy link

I was wondering why all my requests to the API were preceded by an OPTIONS request, before the actual GET request.

This seemed wasteful and I couldn't see what I'd done wrong.

I learned this is called preflighting and is necessary due to CORS restrictions.

If the API key was added to the URL, preflighting wouldn't be necessary saving time. Are you aware of this impact of implementing authentication like that?

@clampr
Copy link
Member

clampr commented Jan 14, 2021

It's a good point. Originally, the API didn't handle CORS requests properly at all. At some point a user requested this feature, so they could use the API with modern JavaScript.

For now I cannot work on this topic because I'm short in time. But it's something I will consider when working on the next version of the API. I'm actually planning to move the API to RapidAPI at some point in the future, so they can handle the authentication for Meteostat.

@clampr clampr added the enhancement New feature or request label Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants