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