search

Home  >  Q&A  >  body text

node.js - Express request cross-domain problem, the request interface just doesn’t work

I want to host the files packaged by vue on node. The static file service has also been started. Now I want to use node to handle post requests in Axios. I also configured cross-domain requests


Access-Control-Allow-Headers Neither configuration works.
The interface has a login,

Then browser cross-domain issues

三叔三叔2720 days ago718

reply all(2)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-06-17 09:18:10

    Now that the vue project has been packaged, can’t you just put it in the public directory under the node project? Not setting app.use(express.static(path.join(__dirname, 'public'))); Well

    reply
    0
  • 天蓬老师

    天蓬老师2017-06-17 09:18:10

    You try to put app.use('/', index); below app.all('*',...).

    reply
    0
  • Cancelreply