POST AJAX request denied - CORS?

后端 未结 4 2025
迷失自我
迷失自我 2020-12-20 13:45

I have setup CORS on my node.js server on port 5000 as follows:

var app = express();

app.use(cors()); //normal CORS
app.options(\'*\', cors()); //preflight         


        
4条回答
  •  青春惊慌失措
    2020-12-20 14:25

    CORS doesn't work using the file protocol because there is no server there to send back the requisite headers. Your solution of using a server is the only way to get CORS to work.

提交回复
热议问题