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.
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?
Comment | File | Size | Author |
---|---|---|---|
#9 | 2922010-scheme-9.patch | 6.13 KB | agentrickard |
#7 | 2922010-scheme.patch | 1.53 KB | agentrickard |
Comments
Comment #2
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedComment #3
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedComment #4
agentrickardWell, 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?
Comment #5
agentrickardSo 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?
Comment #6
agentrickardWorking 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.
Comment #7
agentrickardSimple patch. Needs a test to ensure that the request is always populated.
Comment #8
agentrickardNote that this is not per content item, but per domain.
Comment #9
agentrickardHere's a better patch.
Note that we now have to use getRawScheme() in forms.
Testing at https://github.com/agentrickard/domain/pull/386
Comment #10
agentrickardCommitted.