Google App Engine上的传出HTTP请求位置 [英] Outgoing HTTP Request Location on Google App Engine

查看:73
本文介绍了Google App Engine上的传出HTTP请求位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用NodeJS制成的API(NodeJS v10 + Express v4.16 + Node-Fetch v2.3),在这个API中,我有一个端点需要通过HTTP消耗第三方API/服务的内容请求(POST)

I have an API made with NodeJS (NodeJS v10 + Express v4.16 + Node-Fetch v2.3) and into this API, I have one endpoint that need to consume content from a third-party API/Service via HTTP Request (POST)

问题是:此第三方API 仅接受来自巴西

The problem is: This third-party API only accepts requests coming from Brazil

过去,我的API托管在Digital Ocean上,但根据此规则,我已迁移到GCP(因为DO在巴西没有托管),并在 southamerica-east1 (圣保罗/巴西,根据文档)

In the past, my API was hosted on Digital Ocean, but with this rule I have migrated to GCP (since DO doesn't have hosts in Brazil) and created my App Engine Application under region southamerica-east1 (Sao Paulo/Brazil according with this document)

是的...它可以在我的机器上工作|| _(ツ)_/¯

发生了什么:有时请求运行正常,运行良好,但是在进行一些版本更新(我正在使用CI/CD进行部署)之后,请求下降了.

What's happening: Sometimes the requests runs Ok, working fine, but after some version updates (I'm using CI/CD to make de deployment) the requests goes down.

问题:存在一种控制我的应用程序以仅使用托管区域发出传出请求的方式吗?

The Question: Exist a way to control my application to only use the hosted region to make the outgoing requests??

PS *我不使用flex env,目的是防止自动缩放(和成本增加).(我不知道我是否正确,因为我是GCP的新手)

PS* I'm not using flex env, purposely to prevent auto-scale (and cost elevation). (I don't know if I'm right about it because I'm new on GCP)

推荐答案

Google Cloud Platform的IP共享相同的地理位置(美国),因此我想说请求会失败.您可以查看

The IPs of Google Cloud Platform share the same geolocation (US) so I would say that it's expected for the requests to fail. You can have a look at this and this questions for more info and potential workarounds.

这篇关于Google App Engine上的传出HTTP请求位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆