Search code examples
phpcrongoogle-cloud-platformsendgridgoogle-app-engine-php

Send mail from appengine with application firewall activated


I am developing a microservice with PHP and appengine. I achieved to send emails with sendgrid. For security reasons the firewall was activate, but then the email service did not work enymore.

I know that the firewall its only for incoming traffic in this case, but that was the only thing that i change, and of course if i shut down the firewall the application works.

UPDATED

The appengiene microservice is call from a cron service.


Solution

  • I could fix it! when an App Engine service is used and this is called from a cron job with activated firewall a rule has to be added to allow the ip 0.1.0.1 (Standard environment)

    For more information see the 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