The attached patch allows optionally overriding $base_url for purposes of Pathologic's filtration process. The intention is to use pathologic to make sure internal page URLs go to a particular canonical version which may not be based on the global base_url parameter.

This leverages an optional parameter of the url() function to override it's use of the global $base_url. This parameter is marked as being for internal use.

Use Case

  • Domain A is public facing, http-only.
  • Domain B has SSL support
  • Authenticated traffic is only site staff & administrators.
  • Redirect all authenticated traffic to Domain B (with path-based multi-site) for security
  • Enforce a canonical URL on content created via the "administrative domain" so text render cache is not in a race condition between the use of the two different domains.

I have linked to #2071695: local URLs don't work when Drupal is in a subdirectory as a related issue because of the coincidence that my use case happens to use path-based multisite, but that relates more to the scale on which I am using the functionality requested, not to the functionality itself.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Grayside’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, pathologic-canonical_base_url.patch, failed testing.

Grayside’s picture

That is an interesting test failure which may explain my problem with #2071695: local URLs don't work when Drupal is in a subdirectory.

Grayside’s picture

Status: Needs work » Needs review
FileSize
1.52 KB

Nope, didn't help the other issue. Made adjustments, lets see how the testing stands.

Garrett Albright’s picture

Looks like this approach will still work for D8 too.

This functionality should be testable. Care to write one? :D