I have my site configured to use a base path (e.g. /drupal).
When logging in I get redirected to "mysite.test/drupal/drupal" instead of the expected "mysite.test/drupal".
So the base path is somehow being repeated.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | Screenshot 2023-10-24 at 10.40.31.png | 357.53 KB | joelpittet |
Issue fork samlauth-2939159
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
geertvd commentedComment #3
lpeabody commentedI wonder if this is related to another issue I'm seeing in multilingual sites, where there is a URL prefix being used for all languages (i.e. / is never a resource path, but /en or /fr is)?
Comment #4
roderikThis also sounded to me like it was related to that 'multilingual' issue. So I hope it has been solved in the 3.x release, by #2848809: Login/logout fails with non-default language being active with the URL prefix negotiation.
If not, feel free to reopen.
Comment #5
joelpittetI'm re-opening as it's still an issue, even for non
base_pathsites it ends up with 2 slashes after login.samlauth/src/Controller/SamlController.php:342SamlController::getUrlFromDestinationWe workaround it currently by embedding a destination parameter and strip
base_pathand leading slash as this is what SAMLauth expects and appendsbase_urlin our login link:Comment #6
joelpittetI just realized this was fixed on the 2.x branch but it is broken on the 3.x branch.
https://git.drupalcode.org/issue/samlauth-2939159/-/blob/2939159-redirec...
#2670118: Make getPostLoginDestination / getPostLogoutDestination configurable
#3041903: Issues with destination parameter
Comment #7
joelpittetAttached is a debug step through of the proposed change in action.

Comment #9
joelpittetComment #10
timwoodWe just recently started encountering the double leading slash issue that @joelpittet mentions above. We use SAMLAuth along with the https://www.drupal.org/project/require_login module to force all visitors to login to our Intranet.
Comment #11
joelpittetMy MR above had a side-effect, apparently there are cases where the URL is missing the first slash resulting in:
I'll update the code to mitigate against that possibility (though it might be on our end).
Comment #12
joelpittetI added the
ltrim()that core uses in various partsSee prior art:
Comment #13
joelpittetNeeds something else... tbd
Comment #14
timwoodAny ideas on how to move this forward? It's more of a nuisance, but is still there, lingering...
Comment #15
joelpittetSorry @timwood, I haven't got a chance to dig into what went wrong with my last MR.
Comment #16
joelpittetAdding another related issue #2418219: Deprecate destination URLs that don't include the base path as I dig into this further. Specifically #2418219-22: Deprecate destination URLs that don't include the base path from @claudiu.cristea
Comment #17
joelpittet@timwood This latest solution seems to check all the boxes. I check if there is a base_path and strip it out only when the destination URL is starts with a starting / (which might be always), then the full URL built has a base_path included (can't seem to get around this without manually building it)
Comment #18
timwoodApplied patch and ran login / logout tests with many different urls and the patch seems to be working correctly without adding any errors or issues.
Comment #21
japerryLooks good to me too. Committing to 3.x