Tornado server: enable CORS requests
<p>I have a simple tornado server which has the class: </p>

<pre><code>class BaseHandler(tornado.web.RequestHandler):
    def set_default_headers(self):
        print "setting headers!!!"
        self.set_header("Access-Control-Allow-Origin", "*")
</code></pre>

<p>When a regular (no CORS) request is made, the server answers as expected, including the Access-Control-Allow-Origin header. But when I make a post request coming from different domain (using <code>jQuery.post</code>), the response is 404 and an error is displayed:  "XMLHttpRequest cannot load <a href="http://dev-machine:8090/handshake" rel="noreferrer">http://dev-machine:8090/handshake</a>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:8090" rel="noreferrer">http://localhost:8090</a>' is therefore not allowed access. The response had HTTP status code 404."</p>

<p>Can you tell if I miss something? (another header/other configuration/anything else)</p>