I'm making a PATCH request from a client running on localhost:3000 with the following code:
axios.patch( "http://localhost:3090/v1/users/etc/etc/etc", { name, url, }, { headers: { authorization: AUTH_TOKEN() } } ) To a server configured as follows:
var app = express(); var cors = require('cors'); //etc //var whitelist = [ // 'http://localhost:3000', // 'localhost:3000' //]; //passing this to cors() doesn't help //var globalCorsOptions = { // origin: function(origin, callback) { // callback(null, whitelist.indexOf(origin) !== -1); // } //}; app.use(morgan('combined')); app.use(cors()); app.options('*', cors()); app.use(bodyParser.json({type:'*/*'})); app.use('/v1', router); var port = process.env.PORT || 3090; var ip = process.env.IP || 'localhost'; var server = http.createServer(app); server.listen(port, ip); But the request just hangs. I can do POST/GET fine, but not DELETE/PATCH. The preflight happens fine but the actual request following just sits "stalled" indefinitely. Here's the headers for each request:
Sorry to ask this pretty standard question, but I've tried everything.
EDIT: Added the following to router (still not working):
var router = express.Router(); router.use(function(req, res, next) { res.header("Access-Control-Allow-Headers", "PATCH,DELETE,OPTIONS,GET,POST"); next(); }); 

