Forum Discussion

William__Humphr's avatar
William__Humphr
Icon for Nimbostratus rankNimbostratus
May 02, 2007

Preserving outside accessible URL when directing to a localhost

I have url running on a local server as https://localhost/reporting/login.jsf. I would like to have my outside accessible url (https://www.calgbapps.org/ to point to the local host but preserve the url to where is looks like https://www.calgbapps.org/reporting/login.jsf. I am using verion 9.1 of big-ip ltm. Has anyone done this before?

 

 

Thanks!!
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    If I understand correctly what you're trying to do, the solution detailed here (Click here) should cover everything you need.

     

     

    It requires LTM v9.2 (the stream profile wasn't introduced until then) and you also need to be offloading SSL (clientssl profile applied to the virtual server).

     

     

    (Edit: stream profile was added in 9.1, but iRule STREAM commands weren't added until 9.2)

     

     

    If this doesn't fit the problem you are trying to solve, please post back with clarifications.

     

     

    /deb

     

  • Thanks Deb,

     

     

    I took the rule that you had in the article: Do I have this written right?

     

     

     

    when HTTP_REQUEST {

     

    set origURI [HTTP::uri]

     

    set newURI "/Reporing/login.jsf[HTTP::uri]"

     

    HTTP::uri $newURI

     

    log local0. "Original URI: $origURI"

     

    log local0. "Rewritten URI: $newURI"

     

    }

     

    when HTTP_RESPONSE {

     

    if { [HTTP::status] starts_with "3" } {

     

    set origRedir [HTTP::header Location]

     

    set newRedir [string map {"/Reporting/login.jsf" "" } [HTTP::header Location]]

     

    HTTP::header replace Location $newRedir

     

    log local0. "Original redirect: $origRedir."

     

    log local0. "Rewritten redirect $newRedir"

     

    }

     

    }
  • Thanks Again Deb,

     

     

    once question that I have is that I already have rules in place for other things., how do I incorporate this into the same rule? Also how does this rule know which pool to use?
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    You can either just incorporate this logic into your existing iRule (easiest to manage & troubleshoot) or use priority values to control order of exection with other iRules. More info on that is here: (Click here)

     

     

    If the iRule doesn't specify a pool to which traffic will be sent, the traffic will be sent to the default pool configured in the Resources tab for the virtual server.

     

     

    /d
  • ok thanks!

     

     

    but in my rules I have different rules pointing to different pools that are not in the VS. For example anyone who come to https://www.calgbapps.org/reg know to use pool oracleweb. I need for anyone who hits https://www.calgbapps.org/Reporting to use pool reporting. The thing is that the reporting URL on the linux box is https://localhost/Reporting/login.jsf and I need to mask it so that is looks like https://www.calgbapps.org/Reporting/login.jsf. I apologize if I was not clear in the beginning and I really do appreciate all of your help!!

     

     

    Thanks!!

     

     

    William
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Edited my previous post to correct version references: stream profile was added in 9.1, but iRule STREAM commands weren't added until 9.2, so 9.1 is the minimum requirement for this solution.

     

     

    /d
  • Thanks Deb, I tried the setting that you suggested, but now it just hangs and times out. This is my current rule i have in plaec:

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::uri] contains "/securemail" } {

     

    HTTP::redirect "https://dusky.duhs.duke.edu/messenger/"

     

    }

     

    elseif { [HTTP::uri] contains "/test/" } {

     

    use pool pilotweb

     

    }

     

    elseif { [HTTP::uri] contains "/Reporting/login.jsf" } {

     

    use pool reporting

     

    }

     

    else {

     

    use pool oracleweb

     

    }

     

    }

     

     

    With attentiong on the one that has "Reporting" in it. I have the reporting pool set to port 443 Should this rule be correct with your suggestions?

     

     

    Thanks!!