Answered by:
Images are not showing up in the Azure Dev Ops Server (on premises) after doing TFS Reverse Proxy using HTTPModule

Question
-
User-1804821542 posted
Hi,
In Azure Dev Ops Server (on premises), I have done TFS Reverse Proxy & rewritten the Response HTML to change the URL from "http://tfs.abc.com" to "http://tfs.xyz.com" using HTTPModule.
Because of this HTTPModule, I think the images are not shown. Please let me know if I have to make any changes in the HTTPModule in order to display the missing images.
public void Init(HttpApplication application)
{
application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
}
private void Application_BeginRequest(Object source, EventArgs e)
{
HttpContext context = HttpContext.Current;
ResponseFilterStream filter = new ResponseFilterStream(context.Response.Filter);
filter.TransformString += filter_TransformString;
context.Response.Filter = filter;
}private string filter_TransformString(string output)
{
output = output.ToString().Replace("http://tfs.abc.com", "http://tfs.xyz.com");
return output;
}Saturday, August 31, 2019 1:01 PM
Answers
-
User-1804821542 posted
The following changes in web.config solved the issue:
<!--<validation validateIntegratedModeConfiguration="false" />-->
<modules runAllManagedModulesForAllRequests="false">
<add name="TestModuleHttpModule" preCondition="managedHandler" type="TestModule.TestModuleHttpModule, TestModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8404bgti71a67037"/>
</modules>- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 5, 2019 1:05 PM
All replies
-
User753101303 posted
Hi,
What if you check Response.ContentType to do that only for text/html content?
Not directly related but I always try to fix the source issue ie here rather than generating a wrong link and adding a module to fix this I would really double check if I couldn't generate the correct link right away...
Monday, September 2, 2019 11:09 AM -
User-1804821542 posted
Hi Patrice,
In Azure Dev Ops Server (on premises), I have done TFS Reverse Proxy & rewritten the Response HTML to change the URL from "http://tfs.abc.com" to "http://tfs.xyz.com" using HTTPModule.
Because of this HTTPModule, I think the images are not shown. Please let me know if I have to make any changes in the HTTPModule in order to display the missing images.
Monday, September 2, 2019 11:31 AM -
User753101303 posted
What if using F12 Network and F12 Console to see what happens for those http requests ? Do you have a 404 not found or maybe a message on the console because the content is not valid image data? Then only I try to fix the problem I found. Here you already try to fix the problem without really nothing what is is, which is often slower.
I'm not sure if it is part of the problem but I would try to use response filtering only for HTML content (but first I would prefer to know for sure which problem I'm trying to solve).
Also I'm not sure why TFS couldn't generate the correct links right away. I usally prefer to fix the source issue rather than to have something wrong and adding code to prevent this problem to show up rather than solving why things are wrong to start with.
Monday, September 2, 2019 12:08 PM -
User-1804821542 posted
The following changes in web.config solved the issue:
<!--<validation validateIntegratedModeConfiguration="false" />-->
<modules runAllManagedModulesForAllRequests="false">
<add name="TestModuleHttpModule" preCondition="managedHandler" type="TestModule.TestModuleHttpModule, TestModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8404bgti71a67037"/>
</modules>- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 5, 2019 1:05 PM