API METAR endpoint CORS?

Hello

Any chance VATSIM will allow CORS to the METAR endpoint in the foreseeable future?
Alternatively does anybody know another CORS-enabled METAR-service?

Thank you

So I’m not the guy to answer your question… I can barely spell API never mind know anything about all that tech stuff.

But I’m just curious. What is a “CORS”?

Hi,

CORS is Cross-origin resource sharing. It allows resources to be accessed from a different domain.
Modern browsers block CORS-requests to protect a user’s sensitive information (e.g. banking, social media and other logins) from being exploited by malicious sites.
Since VATSIM’s METAR endpoint is public (no login required and no user information shared), requests from any domain should be granted by setting an Access-Control-Allow-Origin header to * (all domains). Currently I only need access from localhost.

I know I can make a server app that gets the METAR data from VATSIM and then expose that to the web app but a direct request would make it easier.

Yeah thats a change we can make. I’ll look at doing it soon / now depending on what I find. Its been a while since the metar code has been touched.

I’ve set cloudflare to override this header with *. I have a pull request opened to do some updates for the metar service. This change is included in that so metar sets * without cloudflare having to.

Hi Nick,

thank you for your quick action, it’s working now!

:+1:

I’ve updated the metar service to send * itself. Cloudflare rule has been removed.