0

I am deploying ASP.NET Web Application 4.6.1 sample mvc template as a windows container in the "Default Web Site". I access the website through the reverse proxy going to URL

https://{fabric_cluster_fqdn}:19008/{myApp}/{myService}

The reverse proxy handles the request as expected and my website gets the request as

http://{fabric_node_ip}/

Home Page is loaded without any CSS and JS content. Opening browser dev console in network tab I see is looking for resources in paths without the app suffix.

https://{fabric_cluster_fqdn}:19008/Content/
https://{fabric_cluster_fqdn}:19008/bundles/

The page contains links like About, Contact, Register and those are in incorrect format too

https://{fabric_cluster_fqdn}:19008/Home/About

UPDATE #1: Using CssRewriteUrlTransform() did not solve the problem. I removed bootstrap.min.cs to avoid noise. Commented this line:

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css", "~/Content/site.css"));

Added this line:

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/*.css", new CssRewriteUrlTransform()));

UPDATE #2: I dont see a http header received on the MVC application that can be used to construct the correct bundling URL

Connection=Keep-Alive
Accept=text/html, application/xhtml+xml, image/jxr, */*
Accept-Encoding=gzip, deflate
Accept-Language=en-US
Cookie={cookie_data}
Host={private_ip_address}
User-Agent=Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko
dnt=1
X-Forwarded-For={public_ip_address}
X-Forwarded-Host={fabric_cluster_fqdn}:19008
X-Forwarded-Proto=https

UPDATE #3: DefaultTagFormat allows to change the URL for JS and CSS content. I cannot find how to do it for MVC links generated using HtmlHelper.ActionLink()

public void Configuration(IAppBuilder app)
{
  System.Web.Optimization.Styles.DefaultTagFormat = @"<link href=""/{myApp}/{myService}{0}"" rel=""stylesheet""/>";
  System.Web.Optimization.Scripts.DefaultTagFormat = @"<script src=""/{myApp}/{myService}{0}""></script>";
  ConfigureAuth(app);
}
Gustavo Armenta
  • 1,435
  • 12
  • 14
  • Sounds like the problem of bundling. See if [this](http://stackoverflow.com/questions/11355935/mvc4-stylebundle-not-resolving-images) helps. – Xiangdong Mar 16 '17 at 14:47
  • Using CssRewriteUrlTransform() did not solve the problem. I think a custom RewriteUrlTransfrom() that parses http headers injected by the Reverse Proxy and appends {myApp}/{myService} might be the solution. Not sure and never done it before. – Gustavo Armenta Mar 22 '17 at 18:44
  • There is no http header containing {myApp}/{myService} – Gustavo Armenta Mar 22 '17 at 22:14

0 Answers0