I am having issues with POST requests to the Ardor API. This code:

<!DOCTYPE html>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  function myFunction() {
      let nodeurl = "https://testardor.jelurida.com/nxt";
      const query = {
      axios.post(nodeurl, query)
      .then(function(response) {
        document.getElementById("demo").innerHTML = response.data;
      .catch(function (error) {


<h2>Preflight request to CORS enabled Ardor Node fails</h2>

<p id="demo">The result should appear here</p>
<button type="button" onclick="myFunction()">Try it</button>

fails during preflight. Chrome:

Failed to load http://localhost:26876/nxt: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access. The response had HTTP status code 403.

What I understand is that it is not me who needs to send the 'Access-Control-Allow-Origin' header but the Ardor/NXT node.

Likely its just me not getting it. There are options around, you can change the content type, is that possible with NXT API? Is that something anybody had to do?

Its just failing for POST, GET works fine.

Thanks for any pointers in the right direction.

  • 4
    I'm voting to close this question as off-topic because This question should be asked on StackOverflow. – Adam Aug 19 '18 at 14:25

Ardor versions prior to 2.1.0e rejected the OPTIONS Http method. This method is now enabled so the problem should be fixed.

It appears that Axios uses an OPTIONS Http request to check if CORS is enabled and since it was forbidden the response was a 403 response.

  • 1
    So it wasn't me! I assumed a different javascript module would work and tried with Jquery - that worked - Issue solved, thx – Mal Nemark Aug 19 '18 at 16:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.