No 'Access-Control-Allow-Origin' with header : <p>I have an HTTPS server thah works, I'm trying to return an answer to the client. I am able to send a GET request from the client, but when I return a response from the server, I continue to get this error:</p>

<blockquote>
  <p>Failed to load <a href="https://localhost:8000/?uname=user&amp;upass=pass" rel="nofollow noreferrer">https://localhost:8000/?uname=user&amp;upass=pass</a>: Response
  to preflight request doesn't pass access control check: No
  'Access-Control-Allow-Origin' header is present on the requested
  resource. Origin '<a href="http://localhost:63342" rel="nofollow noreferrer">http://localhost:63342</a>' is therefore not allowed
  access.</p>
</blockquote>

<p>What am I doing wrong?</p>

<p>this is my server:</p>

<pre><code>var https = require('https');
var fs = require('fs');

var options = {
    key: fs.readFileSync('key.pem'),
    cert: fs.readFileSync('cert.pem')
};

https.createServer(options, function (req, res) {
    res.write('Hello World!'); //write a response to the client
    res.end(); //end the response
}).listen(8000);
</code></pre>

<p>and this is my client:</p>

<pre><code>    const xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
        if (xhr.readyState === XMLHttpRequest.DONE) {
            console.log(xhr.responseText);
        }
    };
    xhr.open('GET', `https://localhost:8000?uname=${user}&amp;upass=${pass}`,true);
    xhr.setRequestHeader("Access-Control-Allow-Origin","*");
    xhr.setRequestHeader("Access-Control-Allow-Headers","Content-Type");
    xhr.setRequestHeader("Access-Control-Allow-Methods","GET,POST,PUT,DELETE,OPTIONS");
    xhr.setRequestHeader("ccess-Control-Allow-Credentials","true");
    xhr.send();
</code></pre>
