[MAGNOLIA-6496] Internal redirect always prepends context path Created: 12/Jan/16  Updated: 18/Jan/16  Resolved: 13/Jan/16

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 5.4.3
Fix Version/s: 5.4.4

Type: Bug Priority: Blocker
Reporter: Christopher Zimmermann Assignee: Roman Kovařík
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 0.5h
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLDEMO-104 Demonstrate PUR Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Kromeriz 26
Story Points: 2

 Description   

With Jenkins bundle, after registering via PUR, try to login and supply proper credentials.
Browser is sent to wrong URL, a non-existing page. Note the duplication of context "magnoliaPublic/magnoliaPublic".

The incorrect URL.
http://localhost:8080/magnoliaPublic/magnoliaPublic/travel/members/protected.html



 Comments   
Comment by Roman Kovařík [ 12/Jan/16 ]

info.magnolia.cms.util.RequestDispatchUtil#dispatch does:

if (isInternal(redirectUrl)) {
                    redirectUrl = request.getContextPath() + redirectUrl;
}

even if the context path is already part of redirectUrl. The issue doesn't occur when the site is correctly configured.

Comment by Christopher Zimmermann [ 12/Jan/16 ]

How must the site be configured? What is mis-configured?

Comment by Roman Kovařík [ 12/Jan/16 ]

To configure:
/etc/hosts:
127.0.0.1 my.site.com
Then you'd have e.g. http://my.site.com/contextPath/travel/members/protected.html.

Comment by Christopher Zimmermann [ 12/Jan/16 ]

Hmm - if someone downloads the bundle - they should not have to configure hosts in order to test the PUR functionality. It should work ootb. Do you have any suggestions on how this could be accomplished. Or do you disagree?
Maybe RequestDispatchUtil#dispatch should be improved to not duplicate the context.

Comment by Roman Kovařík [ 12/Jan/16 ]

For me it's more an issue in RequestDispatchUtil#dispatch, since

redirect: ${cmsfn.link("website", content.targetPage)!}

gives the link including the context path.

(This code is used in public-user-registration/templates/components/login.ftl )

Comment by Christopher Zimmermann [ 12/Jan/16 ]

I propose that RequestDispatchUtil#dispatch should be improved to not duplicate the context.
It should check if redirectUrl already includes the context - and only add it if it does not.

Generated at Mon Feb 12 04:15:04 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.