Forum Discussion

eric_haupt1's avatar
eric_haupt1
Icon for Nimbostratus rankNimbostratus
Apr 15, 2019

APM VPE Top left logo - any way to dynamically change it per host?

I have a large VPE that I'm splitting across two sharepoint teams using session.server.network.name and two branch rules. Each SP team has a respective logo/badge for their SP sites for their team. I'd like the 4 four possible logon pages to reflect each team if/when accessed in the VPE. Is there a way to dynamically change this image based on Logon page? or am I limited to a single image per access policy?

 

2 Replies

  • Hi

     

    As long as you have got a way to distinguish which team is accessing APM prior to presenting them with a login page then you can change the logo as you need to. For instance, you mention that you are using variable session.server.network.name to split up your policy. Using this variable you could deploy code such as this to intercept the call for the logo on the login page and display a different image.

     

    when CLIENT_ACCEPTED {
        ACCESS::restrict_irule_events disable
    }
    
    when HTTP_REQUEST {
        looks for calls to the logo image
        if {[HTTP::uri] equals "/public/images/my/flogo.png"}{
        if {[ACCESS::session data get "session.server.network.name"] eq "test.domain.com"}{
        HTTP::respond 200 content [ifile get "uri1_image"]
        } elseif {
        [ACCESS::session data get "session.server.network.name"] eq "another.domain.com"}{
        HTTP::respond 200 content [ifile get "uri2_image"]
        }
        }
    }
  • Hi Eric,

    I agree with with Stanislas that

    ACCESS::restrict_irule_events disable
    may have certain side effects.

    I would rather than change the image path based on a custom APM session variable. The value of the session variable would be set during the

    ACCESS_SESSION_STARTED
    event.

    when ACCESS_SESSION_STARTED {
        set apm_policy_name "/Common/MyPolicy"
        switch -glob -- [string tolower [HTTP::host]] {
            "site1.domain.de" {
                ACCESS::session data set "session.custom.logo" "/public/images/customization${policy_name}_general_ui/image01_en.png"
            }
            "site2.domain.com" {
                ACCESS::session data set "session.custom.logo" "/public/images/customization${policy_name}_general_ui/image02_en.png"
            }
            default {
                ACCESS::session data set "session.custom.logo" "/public/images/customization${policy_name}_general_ui/image00_en.png"
            }
        }
    }
    

    The required change to the

    header.inc
    file via "Advanced Customization" would be:

    ...
        
    ...
    

    After that you could upload your default and site specific logo images to APMs "Advanced Customization Images" via the "General Customization" functionality. Image00 would be the new default image and image01 etc. are the site specific logo images.

    Cheers, Kai