[solved] CmsJobManager on SSL/HTTPS website

For problem reports, and discussions about the CMSMS 2.2 beta.

This board will be locked once CMSMS 2.2 is officially released.
Locked
deactivated010521

[solved] CmsJobManager on SSL/HTTPS website

Post by deactivated010521 »

I was trying to add some News message with status unpublished/draft. I found out that CreateDraftAlertTask (Background Job Manager : News\CreateDraftAlertTask) was not triggered correctly on a site running SSL.

Admin Log:
CmsJobManager Received 400 response when trying to trigger async processing

On CmsJobManagerModule.php the $scheme is set to 'https' but the $prefix_scheme always stays null.

Code: Select all

    $scheme = $url_ob->get_scheme();
 
        $prefix_scheme = null;
        if( !$scheme ) {
            $url_ob->set_scheme('http');
            $scheme = 'http';
            if( CmsApp::get_instance()->is_https_request() ) {
                $url_ob->set_scheme('https');
                $scheme = $prefix_scheme = 'ssl://';
            }
        }

....

        try {
            $fp = fsockopen($prefix_scheme.$url_ob->get_host(),$url_ob->get_port(),$errno,$errstr,3);
Sites running https:// needs more testing.

BTW tryed this out with a self-signed SSL certificate first but it also happened on a live site with valid Letś Encrypt Certificate.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: CmsJobManager on SSL/HTTPS website

Post by calguy1000 »

I just added some debug statements, and tested this on a server with a letsencrypt certificate. it worked here.

Looking at the code, the only way that prefix_scheme would not be set on an HTTPS request is if the CmsApp::is_http_request() method returned FALSE.

That function is quite simple, and has been unchanged for years.

Code: Select all

public function is_https_request()
{
    if( isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ) return TRUE;
        return FALSE;
}
so, that tells me that there is something non-standard about your environment.

Can you (when using an HTTPS request) debug your $_SERVER variable.

Code: Select all

<pre>{$smarty.server|@print_r}</pre>   
will work in any content page.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: CmsJobManager on SSL/HTTPS website

Post by calguy1000 »

Correction...

I've found a logic error, and fixed that routine. Testing now.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
deactivated010521

Re: CmsJobManager on SSL/HTTPS website

Post by deactivated010521 »

Okey great.

- function is_https_request gives TRUE at my side.
- do not see anything strange when outputing: {$smarty.server|@print_r}

Will test on svn trunk also.
deactivated010521

Re: CmsJobManager on SSL/HTTPS website

Post by deactivated010521 »

Seems to work while testing at revision 11179:

Admin log shows:
CmsJobManager Processed Job News\CreateDraftAlertTask

And the alert is showing up:

Unapproved News articles
You have 3 that is/are not published


Ad1) After publishing the 3 articles the CmsJobManager triggered again but the alert was not cleared out. Not sure if this is the correct behaviour.

arnoud CmsJobManager Found nothing to do 18 Mar. 2017 20:17:25
CmsJobManager Processed Job News\CreateDraftAlertTask 18 Mar. 2017 20:14:03
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: CmsJobManager on SSL/HTTPS website

Post by calguy1000 »

The alerts do not clear out by themselves. You have to manually clear them.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
deactivated010521

Re: [fixed] CmsJobManager on SSL/HTTPS website

Post by deactivated010521 »

Correct the alerts can be cleared out manually.

Something weird again while looking at the JobManager with Rev 11184.

I placed a few news items to draft mode again but I only get a 302 response code in the Admin Log's:

Code: Select all

192.168.2.16 	arnoud 	  	CmsJobManager 	Received 302 response when trying to trigger async processing
Should I do a fresh installation and or are you still working on background job stuff? See "ReduceAdminlogTask" added.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: [open] CmsJobManager on SSL/HTTPS website

Post by calguy1000 »

A 302 issue probably has more to do with your configuration than with the job manager stuff.

Do you have a mixed http/https site? these days that's probably a bad idea. On the frontend are some pages secure, and others not?
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: [open] CmsJobManager on SSL/HTTPS website

Post by calguy1000 »

Also check your .htaccess for rewrite rules.

CMSMS will use the default pageid when building the action url for the asynchronous processing. If for some reason your site is setup so that every access to the default URL of your site results in a 302 then that would also cause the issue you are seeing.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
deactivated010521

Re: [open] CmsJobManager on SSL/HTTPS website

Post by deactivated010521 »

I tested with a clean cmsms-beta installation without pretty_urls or .htaccess modifications. Will dig into this a bit deeper (print stuff to the admin log) for verification.

Will get back on this later.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: [open] CmsJobManager on SSL/HTTPS website

Post by calguy1000 »

On my brand new 2.2-beta2 install on HTTPS it works as expected (Including CmsJobManager).

I tested this morning, yesterday we played with certificates and IPv6 configuration because we were having lots of problems on the CMSMS servers.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
deactivated010521

Re: [open] CmsJobManager on SSL/HTTPS website

Post by deactivated010521 »

https on cmsmadesimple.org domains looks good. Last week I spotted problems on my ipad and android phone these are solved.

This item can be closed. I did a fresh installation from Rev: 11193 and I don't see anything weird with the jobmanager.

Thank you for your attention.
Locked

Return to “[locked] CMSMS 2.2 Beta”