# 接口出现net::ERR_SSL_PROTOCOL_ERROR

博客内容介绍了在遇到接口请求时出现的net::ERR_SSL_PROTOCOL_ERROR错误,提供了一个简单的解决方案,即把HTTPS协议改为HTTP协议。

日志

xhr.js?b50d:178 POST https://127.0.0.1:5000/login net::ERR_SSL_PROTOCOL_ERROR
dispatchXhrRequest @ xhr.js?b50d:178
xhrAdapter @ xhr.js?b50d:12
dispatchRequest @ dispatchRequest.js?5270:52
Promise.then (async)
request @ Axios.js?0a06:61
Axios.<computed> @ Axios.js?0a06:86
wrap @ bind.js?1d2b:9
login @ Login.vue?7463:85
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854
invoker @ vue.runtime.esm.js?2b0e:2179
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854
Vue.$emit @ vue.runtime.esm.js?2b0e:3888
click @ VBtn.ts?0eff:158
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854
invoker @ vue.runtime.esm.js?2b0e:2179
original._wrapper @ vue.runtime.esm.js?2b0e:6917
createError.js?2d83:16 Uncaught (in promise) Error: Network Error
    at createError (createError.js?2d83:16)
    at XMLHttpRequest.handleError (xhr.js?b50d:83)

解决方案:把https 修改为http

import axios from 'axios'
const instance = axios.create({
    修改后代码:baseURL: 'http://127.0.0.1:5000/',
    修改前代码:baseURL: 'https://127.0.0.1:5000/',
    timeout: 10000,
    headers: {'X-Custom-Header': 'foobar'}
  });
export default instance
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值