I am having problems with paths in an ASP.NET MVC application running behind a proxy server.
Our root path is an IIS application, for example, http: // server / MyApp /
means that all URLs using the application root ("~ /", Url.Action ("MyAction", "MyController")) are allowed for "/ MyApp"
Now we are working behind a proxy server that forwards all requests, but requires you to access the application through a URL, for example: "/ Secury / Proxy / RubbishUrl / MyApp"
Since the proxy server URL is only available on the client, I thought about creating a cookie with a path prefix and pasting it before each generated URL on the server.
Now the question is, what is the best place in the code to change each URL that is allowed / sent to the client (resources, controller actions, images, etc.)?
Each path in the application is resolved using MVC methods (Url.Content, Url.Action, etc.).
Update: Not actively looking for an answer anymore (although still interested in the correct solution)
In most cases, Proxies performs its own translation of URLs; however, in this case, the proxy server ignores the paths that are passed to JSON and they are processed.
My "solution" at the moment is simply not passing the path to JSON, but instead:
- using the correct id and values ββin JSON requests
- creating a template in the URL in HTML (which is correctly resolved),
- replace id and values ββin URL pattern with values ββfrom JSON requests
This method is actually a much cleaner way when IMO passes URLs.