Hello,

I am building a small server with an API to receive & return json objects through http POST/GET.

From js, I tried calling my server using

  $.ajax({
        url: "http://my.domain:8989/register",
        type: "POST",
        crossDomain: true,
        data: { apiKey: "23462", method: "example", ip: "208.74.35.5" },
        success: function (result) {
            resultDiv.innerHTML=result;
        },
        error: function (xhr, ajaxOptions, thrownError) {
        }
    });

Which gives the error:

XMLHttpRequest cannot load http://my.domain:8989/register. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. 

On the server I see something like

IP - - 2014-Jan-26 17:56:15.0144105Z "OPTIONS /register HTTP/1.1" 404 455 "http://localhost/supraball/serverlist.html" "uagent"

So there is an OPTION request to which it response with 404.
How can I respond to OPTION requests and/or how can I add the required header "Access-Control-Allow-Origin"?