Add comment
Name:
Email:
Comment: *
(Use BBcode - No HTML)


How to configure HTTP to HTTPS rewrite on HTTP Response Body Content?

There are few situations where customer application is hardcoded their application with protocol HTTP in the URL. This content is not available in the HTTP Response body and that needs to be rewrite to HTTPS.

Here is the configuration for the same.

Note: This is applicable only for the rewriting the content in the HTTP response body.

Instructions

Below is the config template to rewrite “HTTP” to “HTTPS” which is there in the body.

 Note: following policies are created globally. If you don’t want this rewrite to applicable for few of the virtual services then you can disable the rewrite body on those Virtual Service.

 #http rewrite body on

#http rewrite body on "Virtual_Service_Name"  ----- > Please turn it off on the VS on which you don’t want body rewrite.

 Make sure to enable only mime types on which you would like to have a rewrite.

 #http rewrite body mimetype html

#http rewrite body mimetype plain

#http rewrite body mimetype richtext

#http rewrite body mimetype xml

#http rewrite body mimetype xhtml

#http rewrite body mimetype css

#http rewrite body mimetype js

#http rewrite body statuscode 200 ----- > This rewrite works only for the content which has a HTTP response code as 200. if Server is giving the other response code, you can either add it or change it server response code.

#http rewrite body rule "Substitute s/http:/https:/" "-Ri" "" ----- > Here you can use the strings whichever you wanted to rewrite. In this particular example, we are replacing “HTTP:” to “HTTPS:” in the content received from Real Server on the http body and has a Response Status code as 200.