moserrya / knod

A Tiny HTTP server for your current directory
MIT License
432 stars 17 forks source link

Adding support to CORS #7

Closed hugoleodev closed 10 years ago

moserrya commented 10 years ago

Thanks for adding tests! How does this work? What is the use case?

hugoleodev commented 10 years ago

@moserrya When have you a single page application served by another web server and you want to request json in knod.

The use-case for CORS is simple. Imagine the local api served by knod in http://localhost:1234 and my app in another domain like myapp.local:9000 wants to access. This type of request traditionally wouldn’t be allowed under the browser’s same origin policy. However, by supporting CORS requests, knod can add the Access-Control-Allow-Origin response header that allows my app to access the data.

See more information about CORS.

moserrya commented 10 years ago

Thanks much.