There seems to be an issue with the code that generates SSL virtual hosts (via the SSL feature), when it's combined with the Site Aliases feature and it's auto-redirect capability.

I encountered the problem with the following setup:

  • I have the SSL and Site Alias features enabled.
  • I have a site that is set up on it's primary domain: example.com.
  • The site has an alias of: www.example.com
  • The alias features is configured to automatically redirect to the www.example.com alias.

When the site is verified, the SSL virtual host that is created sets up a redirect, but it incorrectly redirects to the primary domain of the site, not the "www" alias. Meanwhile, in the normal virtual host (port 80), it correctly redirects to the "www" alias.

Here are the rewrite rules that were just generated in my test:

(in the port 443 virtual host:)

 RewriteCond %{HTTP_HOST} !^example.com$ [NC]
 RewriteRule ^/*(.*)$ https://example.com/$1 [NE,L,R=301]

(in the port 80 virtual host:)

 RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
 RewriteRule ^/*(.*)$ http://www.example.com/$1 [NE,L,R=301]
CommentFileSizeAuthor
#3 provision_vhost_ssl_alias-2084963-3.patch818 bytesm.stenta
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anarcat’s picture

Priority: Normal » Critical

this looks like a regression from 1.x

anarcat’s picture

actually, it looks like the problem is not SSL-specific, can you verify if this problem is the same as #2089591: Setting a Redirection Target in the site alias seciton other than the original site takes you to install.php?

m.stenta’s picture

Status: Active » Needs review
FileSize
818 bytes

I dug into this and figured out what's causing the issue. The vhost_ssl.tpl.php file is using the wrong URI variable in the redirect. Attached is a patch that fixes the issue.

I don't think this is the same issue as #2089591: Setting a Redirection Target in the site alias seciton other than the original site takes you to install.php. It's related, but I suspect it is something else. The code in the none-SSL vhost template that handles redirects looks a little funky to me, so I'm going to check that out. Waiting to hear back from SocialNicheGuru in the other issue thread...

I think this one can be fixed now.

anarcat’s picture

so it seems that #1681904: Ability to configure a url to redirect to in site configuration. was actually missing SSL support, so this patch is required! committed, thanks.

chertzog’s picture

Status: Needs review » Fixed

Closing since it was committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit a45905a on dev-drupal-8, 6.x-2.x, dev-ssl-ip-allocation-refactor, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x by anarcat:
    Issue #2084963 by m.stenta: Fixed SSL vhost does not respect Alias...