从启用了应用程序防火墙的 Appengine 发送邮件

Send mail from appengine with application firewall activated

我正在使用 PHP 和应用引擎开发微服务。我实现了使用 sendgrid 发送电子邮件。出于安全原因,防火墙被激活,但电子邮件服务不再工作。

我知道在这种情况下,防火墙仅用于传入流量,但这是我唯一更改的内容,当然,如果我关闭防火墙,应用程序也能正常工作。

已更新

appengiene 微服务是从 cron 服务调用的。

我可以修好它!当使用 App Engine 服务并从具有激活防火墙的 cron 作业调用时,必须添加规则以允许 ip 0.1.0.1(标准环境)

有关详细信息,请参阅 documentation

To control the access of requests from other App Engine apps or services, you might need to create rules to accommodate the IP addresses that are used for service-to-service communication. If your app communicates with other apps or services in App Engine, you must consider how to handle requests from the following IP addresses:

  • Job requests from the Cron service:
    • Requests received in the standard environment: 0.1.0.1
    • Requests received in the flexible environment: 0.1.0.1 and 10.0.0.1