Forum Discussion
JDE Redirects
I'm new to the iRule game, and these things are probably pretty simple to do, but they're beyond me at this time. I'd like to have users just type "jde" into their browsers and have three things happen:
1. Do a redirect to append the internal domain so the name becomes a FQDN. This is to ensure that the browser knows it's an intranet site they're going to and puts them into the right zone.
2. If they're coming in via port 80, send them to port 94 (the JDE default). No HTTPS involved here.
3. Append "/jde/E1Menu.maf" if they come in without a URI.
What would be the best way of doing these things? Thanks
6 Replies
- Brian_69413
Nimbostratus
1. this has nothing to do with the bigip or irules, it is dependent on your browser and DNS configurations
2. just create a virtual that listens on port 80 and a pool that has your server members with port 94
3. you can do this with your irule:when HHTP_REQUEST { if { ([HTTP::uri] eq "") or ([HTTP::uri] eq "/") }{ HTTP::redirect "[HTTP::host]/jde/E1Menu.maf" } } - Kevin_Stewart
Employee
If I may add:
1. Assuming you have DNS entries for both "jde" and "jde.example.com", you could definitely use an iRule to redirect the user to the FQDN:
----------------------
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "jde" } {
HTTP::redirect "http://jde.example.com[HTTP::uri]"
}
}
----------------------
2. 100% agree. Just make sure port translation is enabled in the virtual server configuration.
3. There is practically no condition where the URI will be blank. In the absence of a URI, any modern browser will simply send "/". You can then simplify the iRule logic to look for this minimal URI. - Brian_69413
Nimbostratus
That is good info for 3, thanks! - bhamman
Nimbostratus
Thanks for all the replies. I have the 3 append iRule working. The 1 iRule I've had less success with - the browser (IE9) doesn't seem to redirect, or at least the address bar doesn't indicate it. The 2 scenario just doesn't want to work. When I create a VS for port 94 to a pool on port 94, it works perfectly, but when I change the VS port to 80, I get a 404 error. In the VS, Address Translation is checked, Port Translation is checked, and Source Port is Preserve. I've tried all different combinations without success. Here's what Fiddler says:
404 Not Found
Not FoundThe requested URL /jde/E1Menu.maf was not found on this server.
IBM_HTTP_Server at jde Port 94 - Kevin_Stewart
Employee
1. Try this iRule with some logging:when HTTP_REQUEST { log local0. "Host = [HTTP::host]" if { [string tolower [HTTP::host]] equals "jde" } { log local0. "Catching jde short name - redirecting" HTTP::redirect "http://jde.example.com[HTTP::uri]" } }
Watch the logs and see what happens when you attempt access with the short name. Also, if you can take a client side Fiddler capture, that'll show what the browser is getting back.
2. So just to level set, you have a VIP listening on port 80, and an assigned pool of servers listening on port 94. Port and address translation are enabled. Is this all correct? If you take a capture between the BIG-IP and server I'm confident that you'll see it communicating on port 94. If that's also true, do you perhaps need to include the port in the address to the server? (Ex. http://IP:94/index.html).
Last, silly question, but does the "/jde/E1Menu.maf" URI actually exist on the server? - bhamman
Nimbostratus
I figured it was some weird IBM web server thing, and it was. Our F5 PS guy said that sometimes web apps enforce the listening port by looking for it in the host headers, so I had to modify the port in the headers. Here are the iRules that are on my JDE port 80 VS, in this order. It is now working. Thanks for everyone's help.
1. Redirect the browser to the FQDN if it comes in with a short name
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "jde" } {
HTTP::redirect "http://jde.domain.loc[HTTP::uri]"
}
}
2. Append the URI to send users to the logon page if they come in without a URI
when HTTP_REQUEST {
if {([HTTP::uri] == "/") } {
HTTP::uri "/jde/E1Menu.maf"
}
}
3. Rewrite the host header to tell the app that user really wants to talk to port 94 (thank-you devcentral!)
From: https://devcentral.f5.com/wiki/iRules.http_request_send.ashx
when HTTP_REQUEST_SEND {
Need to force the host header replacement and HTTP:: commands into the clientside context
as the HTTP_REQUEST_SEND event is in the serverside context
clientside {
Replace the HTTP host header with the selected server IP and port
HTTP::header replace Host "jde.domain.loc:94"
}
}
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