Running ASP.NET MVC application behind a proxy with different root relative path
- by Wiebe
Hi All,
I'm having trouble with paths in a ASP.NET MVC application that's running behind a proxy.
Our IIS Application root path is for example http://server/MyApp/
meaning that all urls using the application root ("~/",Url.Action("MyAction","MyController")) are resolved to "/MyApp"
Now we're running behind a proxy server that forwards all requests, but changes the application root to something like this:
"/Secury/Proxy/RubbishUrl/MyApp"
Because the original url is only available on the client, I thought of creating a cookie with the path prefix, and insert this before each generated URL on the server.
Now the question is, what's the best location in code to modify each URL that's resolved/sent to the client (to resources, controller actions, images etc)?
Every path in the application is resolved with the MVC methods (Url.Content, Url.Action etc).