majodev / google-webfonts-helper

A Hassle-Free Way to Self-Host Google Fonts. Get eot, ttf, svg, woff and woff2 files + CSS snippets
https://gwfh.mranftl.com
MIT License
12.02k stars 420 forks source link

Add CORS support #174

Closed mrocha98 closed 1 year ago

mrocha98 commented 1 year ago

This PR adds support for CORS via environment variable (true by default, feel free to change to false)

Motivation: I'm developing an alternative client and all requests fails because of CORS error

resolves #90

majodev commented 1 year ago

I'm not fully sure if the express middleware is the right place for adding CORS headers, as you would typically need to run this service behind a load balancer anyways (e.g. nginx, caddy, haproxy, ..., also for doing TLS termination).

Just to ensure I understand you motivation here, would you also want me to enable CORS on https://gwfh.mranftl.com? I'm afraid this is not going to happen.

mrocha98 commented 1 year ago

Good call, I forgot that Nginx can handle this, much better approach since I'm self hosting.

Thanks for your reponse ✌️