Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

vue-cli怎么查看接口是不是请求的代理域名,network只能看到localhost

问题就是标题
项目用vue-cli搭建,在vue.config.js中配置了proxy,代码如下:

proxy: {
    '/api': {
        target: baseUrl,
        changeOrigin: true,
    },
    '/': {
        target: baseUrl,
        changeOrigin: true,
    },
}

在network中显示的接口请求信息:

    Request URL: http://localhost:8011/xxxx

这个怎么能看到代理的域名是不是我设置的域名?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你把代理target改成 https://www.lilnong.top/cors/ 看一下。返回的内容

如果返回还是你之前的内容,那么就是没走代理。如果是返回的其他内容那么就是走的代理。里面返回了一下你请求的地址,请求头之类的


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...