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.
Sometimes the Drupal interface to let you define which paths should be secured is not enough. Let's say for instance that we want to display the page user/[uid] with HTTP and every other path user/* with HTTPS.
With the default UI, you are stuck.
We need a way to alter those data.
Comment | File | Size | Author |
---|---|---|---|
#2 | securepages-2646042-alter_secured_paths-2.patch | 2.1 KB | Artusamak |
Comments
Comment #2
ArtusamakHere is a patch for that.
Comment #3
leopaccanaro CreditAttribution: leopaccanaro at CI&T commentedDoesn't the ignore pages field accomplish this?
If you keep pattern /user/* under HTTPS and list user/3 (for instance) within Ignore pages field, that should reflect as user 3 as the only one not having to forcedly access profile page under HTTPS.
Comment #4
ArtusamakWe can't edit the value each time a user is created.
The ignore pages list isn't dynamic either.
Comment #5
leopaccanaro CreditAttribution: leopaccanaro at CI&T commentedI noticed drupal_alter is within the if ($pages). So, if someone sets the whole site to be under HTTPs hook_securepages_match_alter will not be called. You might want give some warning about this.
Second, your example didn't work for me.
Instead of ~^user/~, I tried ~^user$~ and it worked better - both www.domain.com/user and www.domain.com/user/.
Let me know if you want to address any of these so I can review.