Forum Discussion

Abhi_001's avatar
Abhi_001
Icon for Nimbostratus rankNimbostratus
Aug 29, 2023

Help with iRule to mask/hide User Personal Information in HTTP Response

I am trying to create iRule to mask or entirely hide the User Personal Information in HTTP Response Below is the sample HTTP response -:     HTTP/1.1 200 OK Cache-Control: private, max-age=0 Con...
  • Abhi_001's avatar
    Aug 29, 2023

    Got it solved with below iRule code -:

    when HTTP_RESPONSE {
        set clen [HTTP::header Content-Length]
        HTTP::collect $clen
    }
    
    when HTTP_RESPONSE_DATA {
    
        regsub -all {<PhoneNumber>(.*?)</PhoneNumber>} [HTTP::payload] {<PhoneNumber>********</PhoneNumber>} fixeddata
        log "Replacing payload with new data."
        HTTP::payload replace 0 $clen $fixeddata
        HTTP::release
    
    }