Forum Discussion

LEHUBY_Jacques_'s avatar
LEHUBY_Jacques_
Icon for Nimbostratus rankNimbostratus
Oct 11, 2018

change body content of an "application/ipp" content type create a malformed packet.

Context : I want to send printing jobs to a pool of CUPS servers through a F5. The application send first a request to CUPS servers to get a list of printers available, through the F5 Application => F5 VS => CUPS server

The body of the CUPS server answer contains the list of printer but also the IP of the CUPS server, so when the apllication want to print it bypass the F5 to sent direcly to the CUPS server

I would like to avoid that, so my idea what to rewrite the content of the body to replace the IP/Port of the CUPS server by the IP/port of the Virtual server.

I used for that a stream profile and an Irule on the VS.

IRULE

"Prevents server compression in responses
when HTTP_REQUEST {

    Disable the stream filter for all requests
   STREAM::disable
   HTTP::header remove "Accept-Encoding"
}
when HTTP_RESPONSE {

    Check if response type is text
   if {[HTTP::header value Content-Type] contains "application/ipp"}{
      STREAM::expression {@10.252.22.30:1631@10.253.56.226:80@}
      STREAM::enable
   }
}
Content of the response packet entering in the F5 (comming from CUPS server)

Date: Thu, 11 Oct 2018 13:02:57 GMT
Server: CUPS/1.6 IPP/2.1
Connection: Keep-Alive
Keep-Alive: timeout=30
Content-Language: en_US
Content-Type: application/ipp
Content-Length: 5292

.........G..attributes-charset..utf-8H..attributes-natural-language..en-us.E..printer-uri-supported.(ipp://10.252.22.30:1631/printers/CEK7101B..printer-name..CEK7101A..printer-location..SiteA..printer-info.
Kyocera SiteA..printer-make-and-model..Kyocera FS-2100D (KPDL)3..copies-supported........'."..page-ranges-supported....E..printer-uri-supported.(ipp://10.252.22.30:1631/printers/CEKSB11B..printer-name..CEKSB11A..printer-location..SiteA..printer-info.
Kyocera SiteA..printer-make-and-model..Kyocera FS-2100D (KPDL)3..copies-supported........'."..page-ranges-supported....E..printer-uri-supported.(ipp://10.252.22.30:1631/printers/CEKSB12B..printer-name..CEKSB12A..printer-location..SiteA..printer-info.
Kyocera SiteA..printer-make-and-model..Kyocera FS-2100D (KPDL)3..copies-supported........'."..page-ranges-supported....E..printer-uri-supported.*ipp://10.252.22.30:1631/printers/CERZQL001B..printer-name. CERZQL001A..printer-location..SiteA..printer-info.  Zebra QLNA..printer-make-and-model..Local Raw Printer3..copies-supported........'."..page-ranges-supported....E..printer-uri-supported.(ipp://10.252.22.30:1631/printers/CETT302B..printer-name..CETT302A..printer-location..SiteA..printer-info..Local RAW Printer SiteA..printer-make-and-model..Local Raw Printer3..copies-supported........'."..page-ranges-supported....

Content of the packet leaving the F5 (after transformation)

Date: Thu, 11 Oct 2018 13:02:57 GMT
Server: CUPS/1.6 IPP/2.1
Connection: Keep-Alive
Keep-Alive: timeout=30
Content-Language: en_US
Content-Type: application/ipp
Transfer-Encoding: chunked

.........G..attributes-charset..utf-8H..attributes-natural-language..en-us.E..printer-uri-supported.(ipp://10.253.56.226:80/printers/CEK7101B..printer-name..CEK7101A..printer-location..SiteA..printer-info.
Kyocera SiteA..printer-make-and-model..Kyocera FS-2100D (KPDL)3..copies-supported........'."..page-ranges-supported....E..printer-uri-supported.(ipp://10.253.56.226:80/printers/CEKSB11B..printer-name..CEKSB11A..printer-location..SiteA..printer-info.
Kyocera SiteA..printer-make-and-model..Kyocera FS-2100D (KPDL)3..copies-supported........'."..page-ranges-supported....E..printer-uri-supported.(ipp://10.253.56.226:80/printers/CEKSB12B..printer-name..CEKSB12A..printer-location..SiteA..printer-info.
Kyocera SiteA..printer-make-and-model..Kyocera FS-2100D (KPDL)3..copies-supported........'."..page-ranges-supported....E..printer-uri-supported.*ipp://10.253.56.226:80/printers/CERZQL001B..printer-name.  CERZQL001A..printer-location..SiteA..printer-info.  Zebra QLNA..printer-make-and-model..Local Raw Printer3..copies-supported........'."..page-ranges-supported....E..printer-uri-supported.(ipp://10.253.56.226:80/printers/CETT302B..printer-name..CETT302A..printer-location..SiteA..printer-info..Local RAW Printer SiteA..printer-make-and-model..Local Raw Printer3..copies-supported........'."..page-ranges-supported....

It seems OK the IP address and port are replaced; but Transfer-Encoding has changed between the frame In and Out and wireshark analyzer tell that the packet going out is malformed.

I don't know what is the issue ! Is it possible to modify any content type or only text content file ?

Jacques

No RepliesBe the first to reply