[英]App Engine Cron Job Always return HTTP status code 301
我已按照本指南為Rails應用程序創建cron作業,但是HTTP狀態代碼始終返回301,而我的作業狀態失敗。 我想念什么嗎?
控制器:
class CronsController < ApplicationController
def example
if request.headers["X-Appengine-Cron"]
Example.do_something
head :ok
else
head :not_found
end
end
end
路線:
get 'crons/example', to: 'crons#example'
cron.yaml
cron:
- description: my cron example
url: /crons/example
schedule: every 2 hours from 03:00 to 07:00
從gcloud app logs read
2017-08-26 07:00:05 default[20170823t153316] "GET /crons/example" 301
兩種可能性,兩種都存在,因為App Engine cron不遵循重定向:
url: /crons/example/
),並進行了修復。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.