0
我跟着this guide为我的Rails应用程序创建cron作业,但HTTP状态代码总是返回301,并且我的作业状态失败。我错过了什么吗?App Engine 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
谢谢。我忘记了我的应用在生产环境中配置了'config.force_ssl = true'。它将使所有非https请求执行重定向。 – kuntoaji