google云功能公共网址

问题描述 投票:0回答:3
如何将公共路线设置为HTTP GCF? 因此,当前默认路径类似这样。

https://us-central1 poised-breaker-162819.cloudfunctions.net/function-1

,但我想以这种方式使用它

https://myfunction.com

or

https://myfunction.com/thisroute

实际上,这是命名界面或什至代表适当函数的问题。如何实现?

update1

似乎,就像我们可以使用端点服务一样。但是它仍然不清楚是否可以与GCF一起使用。 cloud端点充当云功能的API网关。

cloud函数

https:// [cloud_function_region] .cloudfunctions.net/my-function

google-cloud-platform google-cloud-functions
3个回答
6
投票

cloud shell中的set项目ID

gcloud config set project [PROJECT_ID]

部门ESPV2 Beta到云运行。用要用于服务的名称替换
    cloud_run_service_name
  1. gcloud run deploy CLOUD_RUN_SERVICE_NAME \ --image="gcr.io/endpoints-release/endpoints-runtime-serverless:2" \ --allow-unauthenticated \ --platform managed

    在执行命令的末尾,它将具有类似的详细信息
    
    
  2. 服务[Cloud_run_service_name]修订版 [Cloud_run_service_name-00001-CES]已部署并正在服务 100%的流量
  3. https://cloud_run_service_name-65zrpjcu3q-uk.a.run.app

    注意主机名从上述命令(

    cloud_run_service_name-65zrpjcu3q-uk.a.run.app

    创建yaml文件api.yaml with

    openapi
    Specconfig:

    swagger: '2.0' info: title: Cloud Endpoints + GCF description: Sample API on Cloud Endpoints with a Google Cloud Functions backend version: 1.0.0 host: CLOUD_RUN_SERVICE_NAME-65zrpjcu3q-uk.a.run.app schemes: - https produces: - application/json paths: /thisroute: get: summary: Custom function route x-google-backend: address: https://[CLOUD_FUNCTION_REGION].cloudfunctions.net/my-function responses: '200': description: A successful response schema: type: string

    deploy端点配置:
  4. gcloud endpoints services deploy api.yaml

    现在,云功能请求可以通过端点路由
    https://cloud_run_service_name-65zrpjcu3q-uk.a.run.app/thisroute
  5. 也需要使用自定义域名,需要验证域名。为了 这是从
    hore的步骤
    
  6. 如果您使用的firebase函数几乎相同,则可以做到! https://firebase.google.com/docs/hosting/functions

  7. 目前不可能。您将需要API代理,老实说,我不建议曝光公共网站。

    在我的脑海中,目前最优雅的解决方案是创建基于Cloud Pub/sub的简单代理应用程序,您可以在GAP,GKE或新的Cloud运行上运行它,以便您扩展到0。 logic可以动态,如下:

    使用一些内部逻辑阅读请求的URL
  8. 使用URL的路径选择主题


1
投票

我认为最好不要使用HTTP调用机制,因为它不需要任何身份验证。 尝试使用其他选项 -

https://cloud.google.com/functions/docs/calling

  • 您必须设置云负载平衡并用云amor固定。然后在您的云功能上设置入口设置,以仅接受内部流量和云负载平衡。
  • af 2025年,在
  • 映射自定义域
  • 指南中描述了几种用于云运行服务的自定义域的方法 - 包括现在称为云运行函数的Google Cloud函数。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.