Forum Discussion

Lucas_56257's avatar
Lucas_56257
Icon for Nimbostratus rankNimbostratus
Sep 13, 2017

IRules URI with session ID

Hello,

My Big-IP is running on version 12.1.2. I have a irules to change the path an application and work fine.

when HTTP_REQUEST { set http_path [string tolower [HTTP::path]] set http_uri [string tolower [HTTP::uri]]

    if { $http_path starts_with "/security/servletauthentication" } {HTTP::uri "/sense/secserver/ServletAuthentication"}
    elseif { $http_path starts_with "/applications/server" } {HTTP::uri "/sense/appserver/Server"}
    elseif { $http_path starts_with "/sense/secserver/download/" } {}
    elseif { $http_path starts_with "/sense/install/" } {}
    elseif { $http_path contains "/sense/download/" } {HTTP::uri [string map {"/sense/download/" "/sense/secserver/download/"} [$http_uri]]}
    else {drop}

}

But the new version of the application change the request for the download part. when HTTP_REQUEST { set http_path [string tolower [HTTP::path]] set http_uri [string tolower [HTTP::uri]]

    if { $http_path starts_with "/security/servletauthentication"} {HTTP::uri "/sense/secserver/ServletAuthentication"}
    elseif { $http_path starts_with "/sense/install/" } {}
    elseif { $http_path contains "/applications/server" } {HTTP::uri [string map {"/applications/server?download=" "/sense/appserve/Serve?download="} [$http_uri]]}
    else {drop}

} But it not working.

they are the outside and inside request https://xxx.yyyy.com/Applications/Server?download=9466c17b-4c7f-430d-9346-87afa18094b6.ipa

Do you know why?

thank in advance

Best Regards

Lucas

1 Reply

  • Hi,

    In the string map command, don't set $http_uri between brackets!

    HTTP_REQUEST {
        set http_path [string tolower [HTTP::path]]
        set http_uri [string tolower [HTTP::uri]]
        if { $http_path starts_with "/security/servletauthentication"} {
            HTTP::uri "/sense/secserver/ServletAuthentication"
        }
        elseif { $http_path starts_with "/sense/install/" } {}
        elseif { $http_path contains "/applications/server" } {
            HTTP::uri [string map {"/applications/server?download=" "/sense/appserve/Serve?download="} $http_uri]
        } else {drop}
    }
    

    Do you really want to hide internal URLs by external ones? I guess it is more simple to redirect to new URI with 301 redirect.