wakanda

Wakanda Server CORS with HTTPS Connections


I have a request handler set up like this:

httpServer.addRequestHandler("^/send-contact-message", "./rest-extensions/contact-messages.js", "sendContactMessage");

I have CORS set up like this:

<cors enabled="true">
    <domain name="imagesreimagined.com" methods="post"/>
</cors>

My server is set up with Secure Connections (HTTPS) set to Accept only HTTPS from remote & allow HTTP and HTTPS from localhost. If I send a request from a form with action="https://imagesreimagined.store/send-contact-message", I get an error in the browser stating:

XMLHttpRequest cannot load https://imagesreimagined.store/send-contact-message. Origin http://imagesreimagined.com is not allowed by Access-Control-Allow-Origin.

If I set my server’s Secure Connections (HTTPS) to Accept both HTTP and HTTPS connections and change the form action to http, it works. However, I need all remote connections to be https.

I also tried CORS with the 443 port and got the same error.

<cors enabled="true">
    <domain name="imagesreimagined.com:443” methods="post"/>
</cors>

The server calling the Wakanda Server is not SSL, if that makes a difference.


Solution

  • Once I removed the port number from the cors domain name and added SSL to the server that hosts the website posting to the Wakanda Server, it worked.