Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine Cron Requests Using POST

Is it possible to make a cron request to a URL via Google App Engine using method=post. I could not find anything in the documentation allowing different methods other than get.

https://developers.google.com/appengine/docs/python/config/cron#Python_app_yaml_Cron_support_in_the_development_server

like image 236
Justin Avatar asked Aug 13 '13 19:08

Justin


People also ask

How does a cron job invoke a URL?

A cron job will invoke a URL, using an HTTP GET request that is subject to the same limits as other HTTP requests . Free applications can have up to 20 scheduled tasks. Paid applications can have up to 250 scheduled tasks.

What is App Engine Cron service?

The App Engine Cron Service allows you to configure regularly scheduled tasks that operate at defined times or regular intervals. These tasks are commonly known as cron jobs. These cron jobs are automatically triggered by the App Engine Cron Service.

How many times does Cron send job requests?

The Cron service is designed to provide "at least once" delivery; that is, if a job is scheduled, App Engine sends the job request at least one time.

Why is the App Engine Cron service blocked by ingress controls?

Well, it turns out that applying the recommended ingress controls also blocks requests from the App Engine Cron service. In some ways it makes sense — the ingress controls only allow requests from the load balancer, or from within the VPC. The Cron service does not satisfy those requirements and hence is blocked.


2 Answers

the simple answer is no. from the docs it is clearly stated that cron jobs use HTTP GET. the best thing is to change your method to GET and restrict direct access to the url in your app.yaml. like this:

handlers:
 - url: /report/weekly
   script: reports.app
   login: admin
like image 97
blitzblade Avatar answered Sep 21 '22 14:09

blitzblade


It's not possible. The requests will have a header 'X-AppEngine-Cron' that you can check for, that might help if you want to prevent accidental running from a browser.

like image 41
Greg Avatar answered Sep 19 '22 14:09

Greg