I've been working with Node.JS applications for a while now. In Node.JS it's really easy to accept Cross-origin-requests using the NPM package CORS. What I normally do is this:
const cors = require('cors');
app.use(cors());
But at now I want to do an XMLhttpRequest
from my Digital Ocean server to my TransIP webhosting (just FTP). Now I get No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin /* here my website */ is therefore not allowed access
.
How can I enable cross origin request for just one IP (that of Digital Ocean)? I've been looking around for a while, but didn't get wiser. And if not possible, how can I allow all other domains to be able to read JSON files on my webhosting?
Hope someone can help!