[英]Accept self signed certificate on local Apollo's RESTDataSource
[英]Apollo-client self signed certificate
ApolloClient 有没有办法接受来自带有自签名证书的服务器的请求?
import ApolloClient from 'apollo-boost';
const client = new ApolloClient({
uri: `https://${window.location.hostname}:8080/graphql`,
rejectUnauthorized: false
});
请求错误:OPTIONS https://localhost:8080/graphql net::ERR_CERT_AUTHORITY_INVALID
您还可以使用代理选项进行开发:
let fetchOptions = {}
if (!process.env.NODE_ENV !== 'production') {
const https = require('https')
fetchOptions = { agent: new https.Agent({ rejectUnauthorized: false }) }
}
const link = new HttpLink({
uri: 'https://localhost/api/graphql',
credentials: 'same-origin',
fetchOptions,
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.