New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploy Umbraco as a child IIS application not working #11891
Comments
Hey. Yes. Umbraco 9 does not support virtual paths in IIS. Actually that shouldn't be the problem. A "BackOfficeServerVariables" controller already supplies the whole range of URLs. If the "GetServerVariablesAsync" method is tweaked a bit, it can work again. Experimenting a bit in "LinkGenerator" would also help. It is enough to add the virtual path from IIS to the rest of the URL. |
I hope that this will work again sometime, because there is quite a difference having a URL "https://domainname/cms/umbraco" instead of "https://cms.domainname/umbraco" |
Sorry for the specific version, I forgot to put it there. We are using 9.1.2. you are totally right that using another subdomain vs adding a child application is quite different and we were trying to avoid creating a subdomain only for a child application. I am not very familiar with the Umbraco code ( I only spent a few hours on this) but I was able to debug the code up to the LinkGenerator and noticed this is where I could probably do something but I wasn't sure where to get the virtual directory name from there (app settings vs something else). I read something about .net core having the UsePathBaseExtensions. I tried to use it to get something quickly working but no luck. If I remember well, a lot of static methods are used in this area which is not ideal to inject objects or overwrite a service from the UserComposer. I will need to look more into this code to understand it better to see what would be the best solution for us, but I'm not sure I will have the cycles to do so. Meanwhile, I will keep my fingers crossed for a fix in the code base :). I will keep tracking this issue. thanks! |
you can read more about server variables here: https://24days.in/umbraco-cms/2021/umbraco-9-server-variables/ |
On iis you can create two rewrite routings with "Url Rewrite" tool (you must install it first).
After this umbraco return "417 The required antiforgery cookie "UMB-XSRF-V" is not present." |
Its importend to set same app poolt to root folder "Default Web Site" as umbraco use. When its not the same app pool you get unauthorice http error. |
Hi @ylangevin, We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know. For more information about issues and states, have a look at this blog post Thanks muchly, from your friendly Umbraco GitHub bot :-) |
Umbraco extension method "GetUmbracoApiServiceBaseUrl" for class "LinkGenerator" does not return URL with full path. Web-Client use ServerVariables to get resource URL. ResourceVariables is generatet in Umbraco Backend. You can register you handler to "ServerVariablesParsingNotification" and generate own code. In most cases handler generate here resource url with this call: this.linkGenerator.GetUmbracoApiServiceBaseUrl(controller => controller.GetUrl())} This cause in this case URL without the needed pathBase. When someone want to fix it, it would be nixe. I have atm no time for this. To check it you can use folowed code:
|
Subscribing to this. Turns out, this issue is not specific to child applications to IIS, and in fact when attempting to deploy it inside a Docker Linux container, it happens as well. In fact, just changing the Details on the setup in which I attempted to do it:
appsettings.json: // ...
"Umbraco": {
"CMS": {
"Hosting": {
"Debug": false,
"ApplicationVirtualPath": "/cms/"
}
}
}
// ... docker-compose.yml: version: '3.3'
services:
dotnet-umbraco:
image: dotnetumbraco:latest # Taken from my Dockerfile
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.dotnet-umbraco.entryPoints=web
- traefik.http.routers.dotnet-umbraco.rule=Host(`host.name.com`) && PathPrefix(`/cms`)
# - traefik.http.routers.dotnet-umbraco.tls=true
- traefik.http.services.dotnet-umbraco.loadbalancer.server.port=80 With this exact config, the installer shows an error (i.e. the same errors as described in this post regarding the backoffice issues), and the resources in wwwroot cannot load, because they are still mapped to If I load the application with Visual Studio 2022, I can manually change the path (removing Thanks @a-t-k for submitting the PR, hope it gets merged soon. edit: Fixed Umbraco version, it's 9.4.1 not 9.1.4. |
Hey question, is this fixed in v10 or v11? |
@IsaMorphic Not fixed in v10. |
Hey all, I am going to close this issue as "won't fix", please read the reasoning here: #13592 |
Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9
9.1.2
Bug summary
When I setup Umbraco as a child application named "cms" of my web site in IIS, the site returns script errors.
When I browse to the backoffice, I see 404 errors on resource load (js, css, etc.).
When I browse to the client pages, the browser always display a "Page Not Found Error".
Specifics
This was tested in Chrome and Edge trying to access http://[web site url]/cms and http://[web site url]/cms/Umbraco#
IIS setup like this:
the web site and cms application are using their own application pool.
this is the page displayed when browsing to the content pages:
this is the screen displayed when accessing the backoffice. Notice the javascript 404 errors related the the url missing the cms.
.
To enable the child application support, the "ApplicationVirtualPath" setting was set in the appSettings.json:
...
"Umbraco": {
"CMS": {
"Hosting": {
"Debug": false,
"ApplicationVirtualPath": "/cms/"
}
...
Steps to reproduce
In IIS
1 - Create your web site (.net core 5) and set the location to a directory not being Umbraco. Create an application pool with the "No Managed Code" and assign it to the site.
2 - Create a child application to your web site and name it cms. Set the location to the Umbraco client application. Create an application pool with the "No Managed Code" and assign it to the site.
3 - Open the appSettings.json and set the "ApplicationVirtualPath" to either "/cms" or "/cms/".
4 - try to browse to the backoffice: http://[your web site/cms/Umbraco#.
5 - see the 404 errors.
Expected result / actual result
Umbraco should work normally without errors. I should be able to access either the backoffice or content pages.
The text was updated successfully, but these errors were encountered: