[MULTISITE-104] using URIPrefix doest work for .html Created: 24/Jun/21  Updated: 20/Dec/21

Status: Open
Project: Magnolia Multisite Module
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Tomáš Gregovský Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MAGNOLIA-8261 URI2RepositoryMapping does not accept... 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:

 Description   

We have a (micro) site which is  accessible on www.magnolia-cms.com/dxp-benchmark

We have site configuration for it:

mappings:
  website:
    URIPrefix: /dxp-benchmark
    handlePrefix: /dxp-benchmark
    repository: website

which works.

Issue is when accessing page with .html - www.magnolia-cms.com/dxp-benchmark.html I got 404 error.  when trying to set virtual uri mapping redirect:

class: info.magnolia.virtualuri.mapping.DefaultVirtualUriMapping
fromUri: /dxp-benchmark.html
toUri: redirect:/dxp-benchmark

this redirect doesn't work, doesn't trigger.

(when changing either fromUri or URIPrefix, so they are not same, redirect start working, so it seems like URIPrefix is preventing redirect with same fromUri)



 Comments   
Comment by Jan Haderka [ 16/Sep/21 ]

The problem is that URI prefix is greedy and will take every uri that is prefixed by whatever value is specified. Then strip off that value, which when left with nothing, it would go to the handle itself to try to recover the page, but if left with something it would try to match that something as a subpage and (in this case) fail, since all it got is extension.
Fix should just check if whatever is left after stripping the handle is matching the extension and if so, treat that as if the leftover was empty. Or simply strip the extension first as I'm pretty sure it's stripping it off at some point anyway.

As a workaround: Have you tried the other way around? Set URIPrefix to dxp-benchmark.html and create redirect from /dxp-benchmark$ to /dxp-benchmark.html

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