首页 > 解决方案 > 有没有办法让阿波罗反应的 HTTPS 端点?

问题描述

当我有一个 http url 时,按照 apollo react 文档可以正常工作,但是当我使用带有 SSL 的端点时,我遇到了 CORS 错误。

import { ApolloClient} from 'apollo-boost';
import { HttpLink } from 'apollo-link-http';

const link = new HttpLink({
  uri: 'https://mywebsite.dev/graphql',
  useGETForQueries: true
});

const client = new ApolloClient({
  cache,
  link: 
});

我知道 httpLink 是用于 http,但我没有看到任何关于如何实现 https 链接的文档。

标签: graphqlapolloreact-apolloapollo-clientapollo-link

解决方案


我怀疑这是一个 http 链接问题 - https 中的客户端和 https 中的端点是否接受该来源?


推荐阅读