javascript - Node environment uses vue-cli to configure the proxy
PHP中文网
PHP中文网 2017-06-17 09:16:31
0
2
817

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中文网

认证0级讲师

reply all (2)
三叔

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.

    曾经蜡笔没有小新

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

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!