Ability to alias to a different url scheme

I have a site that is available on both http and https. It would be nice if i could specify both schemas.

If I specify one can I switch it to another?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SocialNicheGuru created an issue. See original summary.

SocialNicheGuru’s picture

SocialNicheGuru’s picture

agentrickard’s picture

Well, you can on the canonical domains, (e.g. domain A http://example.com vs. domain B https://example.com).

Aliases are assumed to inherit their scheme from the parent domain.

As a general rule, switching schemas is bad practice, as it can lead to complications with browser handling of assets.

Is this a problem in development or production?

agentrickard’s picture

So we may want to incorporate the patch from https://www.drupal.org/node/758714#comment-11638361 here. There are two ways I can see this going:

1) Each domain may set a value -- http / https / default -- where default is inherited from the current request. (That, however, has issues in cases where we have no current request, such as tests.)

1a) Instead of 'default' as an option, there could be an option that says "inherit scheme from active request, if available." That would require a schema change, which I would rather avoid.

1b) The options could be -- http / https / https-inherit / http-inherit -- where the fallback is used if no request has been made.

2) There is a global setting that says "when generating links from a request, inherit the scheme". (Which is what the referenced patch does.)

Thoughts?

agentrickard’s picture

Working on this now. I'm trying a simple http/https/variable setting. The question is if we can run a test where there is no request. I suspect we can.

agentrickard’s picture

FileSize
1.53 KB

Simple patch. Needs a test to ensure that the request is always populated.

agentrickard’s picture

Status: Active » Needs work

Note that this is not per content item, but per domain.

agentrickard’s picture

Status: Needs work » Needs review
FileSize
6.13 KB

Here's a better patch.

Note that we now have to use getRawScheme() in forms.

Testing at https://github.com/agentrickard/domain/pull/386

agentrickard’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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