阿波罗服务器Azure功能 - 更改沙盒端点

发布于 2025-02-09 13:45:11 字数 723 浏览 0 评论 0原文

我正在使用 apollo服务器,具有azure函数 嵌入式登录页插件的选项,该插件允许将沙箱嵌入服务器端点。

这就是我当前的配置看起来像是

const server = new ApolloServer({
  schema,
  context: ({ context }) => context,
  plugins: [ApolloServerPluginLandingPageLocalDefault({
    embed: true
  })],
});

export default server.createHandler({
  cors: {
    origin: '*'
  },
});

要通过使用Azure Active Directory锁定Azure的功能应用程序,并且没有授权的401:未经授权的请求将被拒绝。但是,问题在于,当在Azure部署时尝试访问沙箱时,也将拒绝访问沙箱。

有没有办法指定一个单独的沙盒端点,该端点可以允许未经验证的请求?然后,从沙盒中,我们可以在授权中发送:Bearer ...标题到实际的GraphQl端点。

I'm using Apollo Server with Azure Functions and as of a v3.8.0 there is a new embed option for the landing page plugin which allows the sandbox to be embedded into the server endpoint.

This is what my current config looks like

const server = new ApolloServer({
  schema,
  context: ({ context }) => context,
  plugins: [ApolloServerPluginLandingPageLocalDefault({
    embed: true
  })],
});

export default server.createHandler({
  cors: {
    origin: '*'
  },
});

I'd like to lock down the Function App in Azure by using Azure Active Directory and having any unauthenticated requests get rejected with 401: Unauthorized. The problem, however, is that would also deny access to the sandbox when trying to access it when deployed in Azure.

Is there a way to specify a separate sandbox endpoint that could allow unauthenticated requests? Then from the sandbox we could send in a Authorization: Bearer ... header to the actual graphql endpoint.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文