Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When running Certificate Login on a non-standard port, e.g. https://www.example.com:8443, the login fails because the form action URL is https://www.example.com/login when it should be https://www.example.com:8443.
Replacing $_SERVER['SERVER_NAME'] with $_SERVER['HTTP_HOST'] in line 97 of certificatelogin.module seems to fix this (at least on Debian etch with Apache 2).
Old version of line 97:
$form['#action'] = 'https://'.$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];
New version of line 97:
$form['#action'] = 'https://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'];
Comments
Comment #1
tony_cowderoy CreditAttribution: tony_cowderoy commentedCorrection! The first sentence should read:
When running Certificate Login on a non-standard port, e.g. https://www.example.com:8443, the login fails because the form action URL is https://www.example.com/login when it should be https://www.example.com:8443/login
Comment #2
flamingvan CreditAttribution: flamingvan commentedThanks for that, tony_cowderoy. I am going to make the changes soon and release new versions. Just a couple of work hurdles to get through first.
Comment #3
flamingvan CreditAttribution: flamingvan commentedTony,
I've made the change. Getting CVS to work always seems to take the most time for me...
Thanks,
Moses
Comment #4
tony_cowderoy CreditAttribution: tony_cowderoy commentedThanks. I've just installed the new version and it seems to work just fine.
Tony
Comment #5
tony_cowderoy CreditAttribution: tony_cowderoy commentedOops! I wrote too soon. I must have been testing the wrong installation. It doesn't work.
You have changed:
$form['#action'] = 'https://'.$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];
to
$form['#action'] = 'https://'.$_SERVER['SERVER_HOST'].'/'.$_SERVER['REQUEST_URI'];
In my PHP installation there is no such value as $_SERVER['SERVER_HOST'].
It should be:
$form['#action'] = 'https://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'];
BTW, ISTR that I made exactly the same mistake when I first tried to fix it.
Tony
Comment #6
flamingvan CreditAttribution: flamingvan commentedAll set. I totally do not get CVS. I finally got that updated but it always takes me forever. I installed tortoise and that helps a little I guess.
Comment #7
flamingvan CreditAttribution: flamingvan commentedfixed