We’re using Umbraco on a load balanced environment (AWS). We’ve configured our load balancer so all traffic with a path starting /umbraco is treated as back office and therefore rooted to our single back office server, all other traffic is rooted to our load balanced servers.
This appeared to be working OK but only recently we’ve spotted preview is broken, the issue here is that the preview page uses an iframe which (through redirects) the src URL ends up without the /umbraco path (see line 37 of \umbraco.presentation\umbraco\dialogs\Preview.aspx.cs) and therefore is rooted to the load balanced servers which don’t have the preview data.
Preview.aspx.cs line 37
Response.Redirect("../../" + d.Id.ToString(CultureInfo.InvariantCulture) + ".aspx", true);
The alternative is we host back office traffic on a different sub-domain, the solution we had we believe is more simple and only requires a single SSL. Does this look like a issue that should be looked at and raised on Umbraco issues?
Has anyone else had this issue before and could share what they did to fix it? Appreciate this is an old post but I am experiencing the same issue on an Umbraco v13 site.
Preview is not working when using the main site domain but when preview is used on the AppService domains it is working as expected.
We have load balanced environment with 2 servers: 1 and 2. According to Umbraco’s documentation, we are serving Backoffice only from Server 1. In order to do this, we have 2 subdomains: admin.example.com for accessing Backoffice (available only from internal network - set up on local DNS server) and content.example.com for accessing Content App (available publicly).
Server 1 listens under both domains and Server 2 under only content.example.com.
In the code we have the following rule: Calls to content.example.com/umbraco are redirected to admin.example.com/umbraco
Calls to admin.example.com/example-page display page normally.
Load balancer only balances load on content.example.com.
When accessing Preview mode we are displaying Content App in an iframe of Backoffice, so we display content of content.example.com in and iFrame on admin.example.com. This causes some problems:
Navigation on the ContentApp contains links to content.example.com subpages. Preview cookie UMB_PREVIEW has domain admin.example.com which is lost when we navigate on the page through links from Navigation. Workaround: I am adding additional UMB_PREVIEW cookie with domain set to ‘*.example.com’ when entering Preview and then removing it when exiting it.
Because links in the Navigation are from content.example.com domain and Preview is displayed under admin.example.com, there is an Umbraco preview controller code that adds ‘target=“_top”’ to all ‘a’ elements, which causes clicking on any link to go out of the iframe and interrupt Preview. Workaround: I have additional js code that runs after everything else was run that takes those ‘a’ elements and remove ‘target=“_top”’.
We had to add special Content-Security-Policy: “frame-ancestors ‘self’ https://admin.example.com;” in order to display ContentApp pages under Backoffice url.
We had to manipulate with Navigation to properly highlight current page when being displayed in the Preview under Backoffice domain as previewed page is displayed from content.example.com/{node_Id} url, not the regular like content.example.com/page1/page2
Creating those workarounds make us think about maintaining them during future Umbraco upgrades.
What are your suggestions to approach Preview in such configuration? Do you know some other solutions?