[MAGNOLIA-5723] HostBasedVirtualURIMapping should select the best matching configured host regardless of order Created: 21/Mar/14 Updated: 01/Apr/14 Resolved: 01/Apr/14 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | content2bean, node2bean |
| Affects Version/s: | 4.5.17, 5.2.3 |
| Fix Version/s: | 4.5.18 |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Christian Ringele | Assignee: | Christopher Zimmermann |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | support | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| 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)
|
||||||||||||||||
| Release notes required: |
Yes
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Description |
|
The simple matching fails in the situation where one of the hosts to match is a subdomain. The matching should select the correct host in this situation as well. For example, Host mappings are: With the current matching strategy (simple check if requested host ends with mapping) both mappings would match, so order would be important. We should ensure that if one mapping is a more accurate match, that it should be selected. |
| Comments |
| Comment by Christian Ringele [ 21/Mar/14 ] |
|
Stefan has placed a code possibility into the support ticket. |
| Comment by Christopher Zimmermann [ 27/Mar/14 ] |
|
HostBasedVirtualURIMapping evaluates the hosts in a new way - not simply taking the first match. Now it chooses the mapping that both matches the request host AND has the least number of additional characters. HostBasedVirtualURIMapping now accepts a new configuration which is more logical and follows magnolia best practice.
* [] virtualURIMapping
* [] default
* - class info.magnolia.cms.beans.config.HostBasedVirtualURIMapping
* - fromURI /
* - toURI redirect:/.magnolia/pages/adminCentral.html
* [] mappings
* - [] com
* - host www.acme.com
* - toURI forward:/acme/en/index.html
* - [] de
* - host www.acme.de
* - toURI forward:/acme/de/index.html
|
| Comment by Milan Divilek [ 31/Mar/14 ] |
|
Reopen: 1. Please add from which version are "hosts" methods deprecated and which methods used instead. int bestMatchValue = 10000;
wouldn't be better to set it to negative value and then in "if" statements check it. Otherwise it looks ok. |