adafruit / Adafruit_CircuitPython_WSGI

WSGI library for simple web servers
MIT License
20 stars 18 forks source link

Allow CORS by handling OPTIONS requests #7

Closed Anton-2 closed 5 months ago

Anton-2 commented 3 years ago

When developing a web application connecting to CircuitPython_WSGI, it's practical to have the web server on the host, and make query to Adafruit_CircuitPython_WSGI from the web application.

In such a scenario, non GET requests are forbidden at the browser level if we don't handle CORS and OPTIONS requests.

I've made a few modifications to handle it unconditionally (allowing all types of requests from any host). Is there any security consideration not to do this ?

I'll post a PR for this shortly.

siddacious commented 3 years ago

I don't see any issue with adding CORS and OPTIONS request support; they'll be useful for sure!

dhalbert commented 5 months ago

We now recommend using https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer instead, and would like to discontinue supporting this library. Would that library meet your needs? Maybe it already addresses what you would like here?

Anton-2 commented 5 months ago

Thanks Dan, and yes, CircuitPython_HTTPServer meets my needs.