【问题标题】:Is there a way to have an HTTPS endpoint for apollo react?有没有办法让阿波罗反应的 HTTPS 端点?
【发布时间】:2020-10-30 16:34:42
【问题描述】:

当我有一个 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 链接的文档。

【问题讨论】:

    标签: graphql apollo react-apollo apollo-client apollo-link


    【解决方案1】:

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

    【讨论】:

    • 客户端和端点都在 https 中。我将不得不看看它是否接受起源。我知道我可以使用 graphiQL 很好地执行查询和突变,但我不确定这在这种情况下是否重要。
    猜你喜欢
    • 2017-07-07
    • 2020-03-18
    • 2018-09-15
    • 2021-02-02
    • 2021-04-03
    • 2018-04-13
    • 2019-02-08
    • 2018-11-27
    • 2017-06-20
    相关资源
    最近更新 更多