diff --git a/README.md b/README.md index b6b3ca3..8c78006 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ The arguments are: - `theforce`: force download the rss feed - `silent`: don't output the final RSS (useless on its own, but can be nice when debugging) - http server only + - `cors`: allow Cross-origin resource sharing (allows XHR calls from other servers) - `html`: changes the http content-type to html, so that python cgi erros (written in html) are readable in a web browser - `txt`: changes the http content-type to txt (for faster "`view-source:`") - `force`: avoid using your browser cache (do not support 304 errors) diff --git a/morss/morss.py b/morss/morss.py index cc0b6ca..d6291d4 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -757,6 +757,9 @@ def cgi_app(environ, start_response): headers['status'] = '200 OK' headers['etag'] = '"%s"' % int(time.time()) + if options.cors: + headers['access-control-allow-origin'] = '*' + if options.html or options.reader: headers['content-type'] = 'text/html' elif options.debug or options.txt: