Cron Job 302 Error

Hi,

We need some advice.

We have set up a cron job on cron-job.org, which gets a 302 error.

The following is the error response headers:
Date: Sat, 22 Jun 2019 18:16:45 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: __cfduid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; expires=Sun, 21-Jun-20 18:16:45 GMT; path=/; domain=.ourdomain.com; HttpOnly X-Redirect-By: WordPress Set-Cookie: wordpress_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ Location: https://ourdomain.com X-Cache: MISS set-cookie: wordpress_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpress_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/wp-content/plugins set-cookie: wordpress_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/wp-content/plugins set-cookie: wordpress_logged_in_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpress_logged_in_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wp-settings-0=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wp-settings-time-0=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpress_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpress_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpress_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpress_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpressuser_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpresspass_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpressuser_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wordpresspass_xxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ set-cookie: wp-postpass_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx1918=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/ Expect-CT: max-age=604800, report-uri=“https://report-uri.Cloudflare.com/cdn-cgi/beacon/expect-ctServer: Cloudflare CF-RAY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The webhook can be executed successfully if we put it manually into the browser.

Please advise.

Jing

In case anyone wants better formatting.

Date: Sat, 22 Jun 2019 18:16:45 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; expires=Sun, 21-Jun-20 18:16:45 GMT; path=/; domain=.ourdomain.com; HttpOnly
X-Redirect-By: WordPress
Set-Cookie: wordpress_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
Location: https://ourdomain.com
X-Cache: MISS
set-cookie: wordpress_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpress_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/wp-content/plugins
set-cookie: wordpress_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/wp-content/plugins
set-cookie: wordpress_logged_in_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpress_logged_in_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wp-settings-0=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wp-settings-time-0=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpress_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpress_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpress_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpress_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpressuser_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpresspass_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpressuser_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wordpresspass_xxxxxxxxxxxxxxxxxxxxxxxx=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
set-cookie: wp-postpass_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx1918=+; expires=Fri, 22-Jun-2018 18:16:45 GMT; Max-Age=0; path=/
Expect-CT: max-age=604800, report-uri=“https://report-uri.Cloudflare.com/cdn-cgi/beacon/expect-ct” Server: Cloudflare
CF-RAY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

302 error means that it was redirected

Yes. I know. How to correct this?

WordPress is redirecting to the location above, most likely because the request had HTTP instead of HTTPS. You either fix this at the source of the request, or at your WordPress installation.

Floripare, should I just change the webhook URL into http when entering it in the Cron job panel?

Hi @gujingc,

I’m not that familiar with the workings of a cronjob setup. In my own sites, I just followed tutorials available at my host support site. So please take anything I say here with a grain of salt.

It seems odd to me that a cronjob would request the home page URL. (Perhaps you have redacted the actual cronjob URL?)

And no, I’d think you should do the other way around to avoid the WordPress redirect, make the cronjob service request the https protocol, not the http.

In the example that was given, WordPress is redirecting from http to https, so you either turn off this redirect in WordPress (something that can have many side effects), or you make the cronjob service request the URL via https, if that is possible.

Last, it seems that you’ve been having issues with cronjobs for a long time now. Your past posts on the issue seemed to have been resolved, though. So if this 302 redirect issue is something new, you should investigate what could possibly have caused it to start happening now. Perhaps a new plugin, or a plugin update?

Have you changed any Cloudflare setting, added a Worker, a new page rule, something that could possibly make CF services the cause of the redirect? If not, then you should investigate your own origin/WP setup, something for which we can’t help you here. Have you tried https://stackoverflow.com?

This topic was automatically closed after 30 days. New replies are no longer allowed.