在 Google Appengine 中使用 CodeIgniter 的 Cron 作业失败
Cron job failed using CodeIgniter in Google Appengine
在 Google App Engine 中使用 PHP 框架,当我将 index.php url 与 login:required
一起使用时,Cron 作业失败。我使用 login:admin
作为 cron。
参考我的 app.yaml 文件
app.yaml
application: my-app
version: 1
runtime: php55
api_version: 1
- url: /.*
script: index.php
login: required
- url: /backup_cron/remindermail
static_dir: backup_cron/remindermail
login: admin
我不想在我的 index.php 负载中使用 no login
和 login: admin
。
我的应用程序只能看到所有拥有 Gmail 登录名的人。没有登录 cron 作业工作正常。
是否可以在第一个加载页面中使用 login:required?
与login:required
日志详细信息:
HTTP/1.1" 302
Request failed because URL requires user login. For requests invoked
within App Engine (offline requests like Task Queue, or webhooks like
XMPP and Incoming Mail), the URL must require admin login (or no
login).
与no login
和login:admin
日志详细信息:
HTTP/1.1" 200
Success
Cron 无法访问受 login: required
保护的 url,因为他们不是 运行 用户。
来自文档:
Note: While cron jobs can use URL paths restricted with login: admin, they cannot use URL paths restricted with login: required because cron scheduled tasks are not run as any user. The admin restriction is satisfied by the inclusion of the X-Appengine-Cron header described below.
也就是说,我建议您为所有受保护的作业使用特定的处理程序。或者您可以重定向未登录的用户。
在 Google App Engine 中使用 PHP 框架,当我将 index.php url 与 login:required
一起使用时,Cron 作业失败。我使用 login:admin
作为 cron。
参考我的 app.yaml 文件
app.yaml
application: my-app
version: 1
runtime: php55
api_version: 1
- url: /.*
script: index.php
login: required
- url: /backup_cron/remindermail
static_dir: backup_cron/remindermail
login: admin
我不想在我的 index.php 负载中使用 no login
和 login: admin
。
我的应用程序只能看到所有拥有 Gmail 登录名的人。没有登录 cron 作业工作正常。
是否可以在第一个加载页面中使用 login:required?
与login:required
日志详细信息:
HTTP/1.1" 302
Request failed because URL requires user login. For requests invoked within App Engine (offline requests like Task Queue, or webhooks like XMPP and Incoming Mail), the URL must require admin login (or no login).
与no login
和login:admin
日志详细信息:
HTTP/1.1" 200
Success
Cron 无法访问受 login: required
保护的 url,因为他们不是 运行 用户。
来自文档:
Note: While cron jobs can use URL paths restricted with login: admin, they cannot use URL paths restricted with login: required because cron scheduled tasks are not run as any user. The admin restriction is satisfied by the inclusion of the X-Appengine-Cron header described below.
也就是说,我建议您为所有受保护的作业使用特定的处理程序。或者您可以重定向未登录的用户。