search

Home  >  Q&A  >  body text

javascript - Node environment uses vue-cli to configure the proxy

I set up an environment locally, and then wanted to access the interface of the company's server. How to do it? You need to bring your login information and other status. How to use it can save more trouble.

I have tried writing it in configindex.js, but there are no cookies or anything. There is no return from the interface.

proxyTable: {
    '/api': {
        target: 'http://www.baidu.com/',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/'
        }
    },
},
PHP中文网PHP中文网2759 days ago905

reply all(2)I'll reply

  • 三叔

    三叔2017-06-17 09:18:31

    I don’t know how the status of your login information is stored. Currently we are trying jwt. You can search for this. The user’s basic information and expiration time are encrypted in the token and do not require storage on the server side. You can refer to the following.

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-17 09:18:31

    If you are using axios
    axios.defaults.withCredentials = true

    reply
    0
  • Cancelreply