Forum Discussion
URI's and IIS
Sorry if this has been asked before, I was not sure what to search for on this as I am not very familiar with IIS.
I have an iRule that is taking www.company.com and sending traffic to different pools based on the URI that is requested.
Example:
www.company.com/app1 -> server pool 1
www.company.com/app2 -> server pool 2
The iRule preserves the URI and the rest of the data afterwards and there are several directories set up on the destination server.
What I'm noticing is that when requests get sent through the iRule to IIS, for example www.company.com/app1/doc/file123.pdf, IIS sees the request for the path as /app1/doc/file123.pdf. Makes sense, that's what the request is for.
What ends up being a problem is that a previously installed application has a top level directory of /doc and returns a 404. The folder structure would have to be reconfigured with a directory above it for /app1 and potentially the app itself as well.
Is there any sort of way to modify the request sent to the pool that can exclude the first part of the URI? Is this a bad idea, and is there a better way to handle this in IIS? I like to keep iRules simple and straightforward if at all possible.
1 Reply
- Kevin_Stewart
Employee
You can rewrite the incoming URI any way you like with the HTTP::uri command:
when HTTP_REQUEST { if { [HTTP::uri] starts_with "/images" } { rewrite the URI HTTP::uri [string map -nocase {"/images" "/img"} [HTTP::uri]] } }Here I used the HTTP::uri command to both read and write the URI.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
