The set-header if valid would be processed as part of the next line after the content and headers are cleared.
This is the response from the server that is being requested, it goes through each header and adds them.
for (int i = 0; i < response.Headers.Count; i++)
The line you are talking about and criticizing is for the response to the client from the proxy server, not the content from the server that was requested.
See the difference? The context variable refers to the request being sent back to the browser, the
response variable refers to the response from the server that was being proxied.
So to answer your question
>> I can't see any obvious implications of doing this, nor why you'd actually want to clear the server headers on the proxy (after all, it /is/ a proxy ;) )
With another question, why wouldn't you want the canvas cleared before writing the contents of the proxy to the response? After all it is a proxy, and should only be showing the content that was actually sent back from the server, not stuff mixed in
from ASP.NET setting up the response. :)
By the way, I have tested the scenario you have been talking about, and I am not seeing the issues you are talking about. Please provide a fiddler dump of the problem you are seeing. You can put fiddler on your server and set it up
to monitor both connections by uncommenting the <system.net> tag in the web.config. You can attach the fiddler files to the issue I have created below.