HTTP Content Rewrite – FortiBalancer

8.3 HTTP Content Rewrite Configuration

8.3.1 Configuration Guidelines

Before you start to configure HTTP Content Rewrite, please take a moment to familiarize yourself with the network architecture for HTTP Content Rewrite configuration.

 

Figure 8-3 HTTP Content Rewrite Topology

As shown above, the real server is hidden behind the FortiBalancer appliance, and the end user can only access the IP address “172.16.85.74” of the virtual service “vs1”. If the end user wants to visit the Web resource “a.xml” on the real server “10.3.129.1”, the source URL address “http://10.3.129/1/a.xml” should be rewritten into “http://172.16.85.74/a.xml”.

Table 8-1 General Settings of HTTP Content Rewrite

Operation Command
Enable HTTP Content Rewrite http rewrite body {on|off} [virtual_name]
Operation Command
Configure HTTP Content Rewrite rules http rewrite body rule <rule> [flags]
Configure the file type to be rewritten http rewrite body mimetype <mime_type>
Add a URL regex into a URL list http rewrite body url list <url_list> <url_regex>
Configure to permit rewriting the string that matches the URL regex in a URL list http rewrite body url permit <virtual_service> <url_list>
Configure to deny rewriting the string that matches the URL regex in a URL list http rewrite body url deny <virtual_service> <url_list>
Configure to rewrite the files that contain specific HTTP response status code http rewrite body statuscode <response_code>

8.3.2 Configuration Example via CLI

  • Step 1 Configure the virtual service

FortiBalancer(config)#slb virtual http “vs1” 172.16.85.74 80 arp 0

  • Step 2 Enable the HTTP Content Rewrite function

FortiBalancer(config)#http rewrite body on

  • Step 3 View the status (enable/disable) of HTTP Content Rewrite

FortiBalancer(config)#show http rewrite body status http body rewrite:         enable per-vs status “vs1”:         enable

  • Step 4 Configure an HTTP Content Rewrite rule to rewrite the IP address “10.3.129.1” into “172.16.85.74”

FortiBalancer(config)#http rewrite body rule “ProxyHTMLURLMap 10.3.129.1 172.16.85.74” -R

  • Step 5 View the defined HTTP Content Rewrite rules

FortiBalancer(config)#show http rewrite body rule http rewrite body rule “ProxyHTMLURLMap 10.3.129.1 172.16.85.74” “-R”

  • Step 6 Configure the type of files to be rewritten

FortiBalancer(config)#http rewrite body mimetype xml

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.