Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • da3246 6 posts 26 karma points
    Dec 07, 2012 @ 14:36
    da3246
    0

    usedomainprefixes not working with hostnames for shared content in 4.11.1

    I setup an umbraco installation using 4.8.1 to manage 3 websites within 1 umbraco installation. Each site had a unique hostname allocated to it: test.site1.com, test.site2.com etcWe wanted to share content between the 3 websites, so useDomainPrefixes was set to false so that niceurl would return relative links.In the properties for each page on all the sites, the "link to document" would show a relative link and the "alternative links" should show the fully qualified link to the page using the hostname.In 4.8.1 this was all working fine, using the different hostnames would take us to the correct homepage, and with niceUrl returning relative links, we could access content from one site within another site.After upgrading to 4.11.1, despite having useDomainPrefixes set to false, niceUrl always returns fully qualified domains, so sharing content between the 3 sites doesn't work.The properties for each page now show only the fully qualified address under "link to document".If I remove the hostname, niceUrl will return a relative address, but whether niceUrl returns an absolute or relative address seems to be affected by entering a hostname or not regardless of the useDomainPrefixes.Has anyone else seen this behaviour? When  useDomainPrefixes is set to false, should niceUrl still return a relative address even when using hostnames?

  • da3246 6 posts 26 karma points
    Dec 07, 2012 @ 14:45
    da3246
    0

    (Formatting above was lost and couldn't edit)

    I setup an umbraco installation using 4.8.1 to manage 3 websites within 1 umbraco installation. Each site had a unique hostname allocated to it: test.site1.com, test.site2.com etc

    We wanted to share content between the 3 websites, so useDomainPrefixes was set to false so that niceurl would return relative links.In the properties for each page on all the sites, the "link to document" would show a relative link and the "alternative links" should show the fully qualified link to the page using the hostname.

    In 4.8.1 this was all working fine, using the different hostnames would take us to the correct homepage, and with niceUrl returning relative links, we could access content from one site within another site.

    After upgrading to 4.11.1, despite having useDomainPrefixes set to false, niceUrl always returns fully qualified domains, so sharing content between the 3 sites doesn't work.

    The properties for each page now show only the fully qualified address under "link to document".If I remove the hostname, niceUrl will return a relative address, but whether niceUrl returns an absolute or relative address seems to be affected by entering a hostname or not regardless of the useDomainPrefixes.

    Has anyone else seen this behaviour?

    When  useDomainPrefixes is set to false, should niceUrl still return a relative address even when using hostnames?

    Looking through the bug tracker, the only related change I could see between 4.8.1 and 4.11.1 was this: http://issues.umbraco.org/issue/U4-456

  • Stephen 767 posts 2273 karma points c-trib
    Dec 07, 2012 @ 15:03
    Stephen
    0

    Ouch.

    That would be the expected behavior of 4.10 and later. If a hostname is set on a tree branch, and you request the url of a node in that branch while browsing another hostname, then NiceUrl will return an absolute url with what it believes is the correct domain. Example:

    Content
    - Node A (example.com)
    - - Node A1
    - Node B (another.com)
    - - Node B1

    When browsing another.com/node-b1, the NiceUrl of Node A1 is going to be absolute and example.com/node-a1 since you explicitely defined a hostname on node A. And anyway, the way hostnames work, another.com/node-a1 would end up in a 404 Not Found because there is no "node-a1" under another.com.

    That being said I understand your issue... trying to think about it...

    (edit: one thing to note is that the behavior changed because the previous one, which you relied upon, produces totally unpredictable results in some multi-sites scenarios where people would end up seing pages from one site right within another site...)

  • da3246 6 posts 26 karma points
    Dec 07, 2012 @ 17:25
    da3246
    0

    In the short term I think I'll restore our 4.8.1 backup and then upgrade to 4.9.1, but I'll need to rethink how we share content between the sites before trying to go to 4.11.1 again.

    If I created a new node for shared content, with no hostname set, would the content in that be accessible from the other sites?

  • Stephen 767 posts 2273 karma points c-trib
    Dec 07, 2012 @ 17:38
    Stephen
    0

    No, because as soon as a node with a hostname exists it captures every request with that hostname.

    Best setup I can think of at the moment would be:

    Content
    - Shared (example-1.com/shared, example-2.com/shared)
    -- Shared Page 1
    -- Shared Page 2
    - Site 1 (example-1.com)
    -- Pages...
    - Site 2 (example-2.com)
    -- Pages...

    And that should work.

  • Mike Chambers 636 posts 1253 karma points c-trib
    Dec 07, 2012 @ 22:20
    Mike Chambers
    0

    we had something similar... I ended up writing a different implemenation of niceUrl... to check if niceUrl contained the current host name... and remove if it did.

  • da3246 6 posts 26 karma points
    Dec 17, 2012 @ 14:22
    da3246
    0

    I've been testing the suggested setup:

    Content
    - Shared (example-1.com/shared, example-2.com/shared, example-3.com/shared)
    -- Shared Page 1
    -- Shared Page 2
    - Site 1 (example-1.com)
    -- Pages...
    - Site 2 (example-2.com)
    -- Pages...
    - Site 3 (example-3.com)
    -- Pages...

    However, when on example-2.com or example-3.com, niceurl is always returning links to shared pages as example-1.com/shared.

    The shared node has all hostnames added and the behaviour isn't affected by changing useDomainPrefixes.

    I was expecting niceurl to return the correct hostname based on the current page, but maybe I've missed something?

    I could probably sort the links now using umbraco.library:Replace to remove the hostname, but I'm hoping there is a cleaner way?

     

  • Stephen 767 posts 2273 karma points c-trib
    Dec 17, 2012 @ 15:02
    Stephen
    0

    @da3246: you got bitten by bug http://issues.umbraco.org/issue/U4-1321 which is a realy issue... basically, we don't know which domain to pick when creating a url for the shared part. Also read the discussion here https://groups.google.com/forum/?hl=en&fromgroups=&pli=1#!topic/umbraco-dev/xuYwiIC3zWA -- we need as much ideas as possible so we can implement something asap.

  • Amir Khan 1287 posts 2744 karma points
    Feb 19, 2013 @ 22:17
    Amir Khan
    0

    Were you ever able to resolve this? I'm trying to set up a shared content repository and am running into the same issue.

  • Stephen 767 posts 2273 karma points c-trib
    Feb 20, 2013 @ 08:28
    Stephen
    0

    @Amir: that's work in progress with a goal of being able to have a solution when 6.1 is out.

  • Amir Khan 1287 posts 2744 karma points
    Feb 20, 2013 @ 17:10
    Amir Khan
    0

    HI Stephen! Is there any sort of workaround for now?

  • Stephen 767 posts 2273 karma points c-trib
    Feb 20, 2013 @ 17:11
    Stephen
    0

    @Amir: sorry, none that I'm aware of.

  • Amir Khan 1287 posts 2744 karma points
    Feb 20, 2013 @ 17:29
    Amir Khan
    0

    Hmm, I wonder if I just don't use the host header functionality in Umbraco and somehow simulate it with Url Rewriting?

  • Fergus Davidson 309 posts 588 karma points
    May 22, 2013 @ 13:42
    Fergus Davidson
    0

    hi

     

    this a major issue for us, now, with a couple of sites. [multiple domains with a shared section for all sites]

    is there a workaround or fix? i am using v4.11.5

    if not, is this 'fixed' in v6.1 as suggested?


  • Stephen 767 posts 2273 karma points c-trib
    May 22, 2013 @ 14:01
    Stephen
    0

    @Fergus: so your setup is

    Content
    - Node A (domain-a.com)
    - - Some page
    - Node B (domain-b.com)
    - - Some page
    - Shared
    - - Some page

    Is that correct, or do you have many "shared" pages? If that is your setup then defining "domain-a.com/shared" and "domain-b.com/shared" on "Shared" is the way to go. Now if you have dozens of "shared" nodes that is different.

  • Fergus Davidson 309 posts 588 karma points
    May 22, 2013 @ 14:07
    Fergus Davidson
    0

    Stephen, 

    i do have a whole shared section, so i have set up domain-a.com/shared, domain-b.com/shared on the shared node, but i still seem to be experiencing some issues.

    i am going to have a bit of a dig around [inherited site/code] and see if there is anything obvious, thanks for the help... i may be back for more.

  • Stephen 767 posts 2273 karma points c-trib
    Jun 19, 2013 @ 09:13
    Stephen
    0

    Back to this thread. Supporting shared content "again" is possible and quite easy in 6.1+.

    See my presentation at CodeGarden 13 at http://www.zpqrtbnk.net/TheUmbraco6RequestPipeline.pdf

    Stephan

Please Sign in or register to post replies

Write your reply to:

Draft