我正在设置将访问另一个用NodeJS+Express编写的云运行服务的ESPv2。我可以直接访问NodeJS+Express服务,但希望使用ESPv2限制访问。
ESPv2的安装没有任何问题,但我有以下问题。
当我使用ESPv2访问NodeJS+Express云运行服务时,NodeJS+Express服务触发器必须使用“允许所有流量”和“允许未经授权的调用”。
如果我将访问限制为仅允许内部流量,ESPv2将无法访问NodeJS+Express云运行服务。
我应该做些什么来授权ESPv2和被调用的NodeJS服务之间的调用?
yaml的顶部部分如下所示
swagger: "2.0"
info:
description: "APIs for managing My Site"
version: "0.0.3"
title: "My API"
contact:
email: "email@email.com"
license:
name: "Copyright Amzu IT Ltd"
host: "apihost-xxxx.a.run.app"
x-google-endpoints:
- name: "apihost-xxxx.a.run.app"
allowCors: True
x-google-backend:
address: https://<nodejs-expess-cloud-run-url>.a.run.app
protocol: h2
schemes:
- "https"
paths:
/test:
get:
operationId: Testing
summary: A Test Endpoint to check if the URL is working.
description: A Test Endpoint to check if the URL is working, does not have any security enabled for this URL.
responses:
200:
description: Success
schema:
type: "string"
security:
- key: []
securityDefinitions:
key:
type: apiKey
in: header
name: x-api-key
firebase:
authorizationUrl: ""
flow: "implicit"
type: "oauth2"
x-google-issuer: "https://securetoken.google.com/REMOVED"
x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com"
x-google-audiences: "REMOVED"发布于 2021-05-27 04:53:15
好的,我知道您的ESPv2部署在Cloud Run上,而您想要访问另一个Cloud Run。
我写了an article on that,如果你愿意,你可以依赖它。
https://stackoverflow.com/questions/67708486
复制相似问题