Hi @gman ,
i grabbed out the old code which i used for this kind of issue.
In fact, i created a functionapp in azure. Created a js function which is triggered by a request. The code of the function is like this:
```
var https = require('https');
module.exports = function (context, req) {
var options = {
hostname: 'mytargethost.atargetdomain.com',
//port: 443,
path: '/v1/tag',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key' : 'abcdefghi'
}
};
var fwdreq = https.request(options, function(res) {
var data = "";
//res.setEncoding('utf8');
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
context.res.body = data;
context.done();
});
});
fwdreq.on('error', function(e) {
context.res.body = 'problem with request: ' + e.message;
context.done();
});
fwdreq.end(JSON.stringify(req.body));
};
```
So, an incoming requests triggers the creation of an https request itself. The url 'mytargethost.atargetdomain.com' is the url which did not have cors allowed.
I had to additonally pass in an api key, which is also great here because you do not have to reveal your key upon request from ypout portal 🙂
When the forwarded request is finished, the result is sent to the original request.
Yes, urls and keys could be in environment variables...
Then, i enabled cors for my website and the stuff went smooth for me.
From the perspective of 'mytargethost.atargetdomain.com', it is not a cors request anymore, its a simple request from a client.
No idea, whether tThe code still works, but you will get the idea 🙂
Hope it inspires you,
Christian
PS infos on functions: https://docs.microsoft.com/en-us/azure/developer/javascript/how-to/develop-serverless-apps

PPS just checked it, still works, even my api code is still valid 🙂 - for more informations on https requests with node js see here: https://nodejs.dev/learn/making-http-requests-with-nodejs