TinyWebServer icon indicating copy to clipboard operation
TinyWebServer copied to clipboard

CORS Header

Open kadu opened this issue 9 years ago • 1 comments

How can I send header: Access-Control-Allow-Origin: * ?

kadu avatar Jan 17 '16 11:01 kadu

The method that lets you do that is not appropriately named, but still does what you want:

web_server.send_content_type("Access-Control-Allow-Origin: *");

You'd need to place that line in your custom handler function. In the SimpleWebServer example you would put that linke in index_handler(), just before the end_headers() call.

ovidiucp avatar Jan 17 '16 22:01 ovidiucp