i’m facing a ERR_CONNECTION_REFUSED on client-side, hosted on heroku app and my node back-end server, running in my PC. i have configured CORS on server.js this way: var express = require(‘express’) var cors = require(‘cors’) var port = process.env.PORT || 5000 var app = express() app.use(cors()); app.use(express.json()) app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*") res.header(‘Access-Control-Allow-Methods’, ‘GET,PUT,POST,DELETE’); […]
- Tags '*'); res.header('Access-Control-Allow-Methods', 'GET, 'PUT', 'X-Requested-With'], //['Content-Type', Accept") next() }) app.listen(port) i can't make a simple GET Request on client side. i've tested with axios and fetch fetch('http://m, but requested an insecure XMLHttpRequest endpoint 'http://myRemoteIp:5000/test'. This request has been blocked; the content must be served ov, DELETE'); res.header('Access-Control-Allow-Headers', firstly i got this error: Mixed Content: The page at 'https://tcchotel.herokuapp.com/' was loaded over HTTPS, hosted on heroku app and my node back-end server, i did the port forwarding and tested on i think that i need to mention, i'm facing a ERR_CONNECTION_REFUSED on client-side, it works. So i think the problem its really with the cross origin. PS: My port its open, next ) { res.header("Access-Control-Allow-Origin", Origin, post, remaining the ERR_CONNECTION_REFUSED Please tell me what i'm doing wrong, res); }); }, running in my PC. i have configured CORS on server.js this way: var express = require('express') var cors = require('cors') var port = pro, Thank you for reading until here.