1 / 35

APV Technical Training

APV Technical Training. HTTP Content Rewriting. 2014/10/25. Objectives. Describes HTTP Content Rewrite Concepts. Describes HTTP Content Rewrite Configuration. Describes HTTP Content Rewrite Examples. 10/25/2014. 2. Topics. Unit 1: Introduction of HTTP content rewrite

Télécharger la présentation

APV Technical Training

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. APV Technical Training HTTP Content Rewriting 2014/10/25

  2. Objectives Describes HTTP Content Rewrite Concepts. Describes HTTP Content Rewrite Configuration. Describes HTTP Content Rewrite Examples 10/25/2014 2

  3. Topics Unit 1: Introduction of HTTP content rewrite Unit 2: Content Rewrite Rules Unit 3: Content Rewrite Filter Regex Unit 4: HTTP Content Rewirte CLI & WebUI 10/25/2014 3

  4. Introduction Unit 1: Introduction of HTTP content rewrite 10/25/2014 4

  5. HTTP Content Rewrite –Case I • In this topology, end user access the applications on the backend server through APV. And the Web pages that the applications response contains links with private IP addresses or internal domain names. • When the clients fetche the pages via those internal links through APV, the browser will not be able to retrieve the images and other objects on the HTML page due to the HTML links pointing to the internal IP addresses,not to the APV appliance. 10/25/2014 5

  6. HTTP Content Rewrite - Solution I • The real server is hidden behind the APV appliance, and the end user can only access of the virtual service“vs1” with IP address“172.16.85.74” • . • The Web pages that the applications generate • contains link http://10.3.129.1/a.doc • APV will rewrite the source URL http://10.3.129.1/a.doc to http://172.16.85.74/a.doc for the client visiting the resource a.doc. http://172.16.85.74/a.doc” 10/25/2014 6

  7. HTTP Content Rewrite - Solution II • In order to rewrite the link in the web page, Array APV need check the response body • When receving response, uproxy check the response and send the response body need rewritting to the rewrite module. • Rewrite module will rewrite the content accoding rewrite rules and will send back the rewritten content • Uproxy caches the rewritten content if need and sends it to client 10/25/2014 7

  8. Content Rewrite - Advantages • Improve the user experience • The HTTP Content Rewrite help external end users from visiting the internal real server hidden behind the APV appliance. It rewrites the Web page file into the valid format to end users. The APV appliance also supports to rewrite the multibyte character files such as Chinese and Japanese. • Reduce the effect to the performance • Comparing with the URL rewrite method, the HTTP Content Rewrite feature causes less communication with the real server to reduce the effect to the performance. • Decrease the response time • In addition, the rewritten pages can be cached by the APV appliance so that APV does not need to rewrite the same pages over and over again. When the client requests the real server for the same Web page, the APV appliance will response the client by the cached data to decrease the response time. • Easy to maintain • The HTTP Content Rewrite feature helps enterprise decrease the cost of the human resource. The administrator needs less monitoring because the HTTP Content Rewrite feature rewrites the Web page file by the rewrite driver and the rewrite module automatically.Provides WAN (Wide Area Network) link redundancy and failover for high-availability internet access. 10/25/2014 8

  9. Content Rewrite - Impact • Cache the rewritten response body • Uproxy will cache the rewritten response body if it need to be rewritten. • When the rewrite rule changed, the cached objects will be still here. • Clear cache content may be helpful if the rewrite rule changed. • L7(HTTP|HTTPS) throughput affected • Content Rewrite module may be a bottle neck of L7 SLB performance, l7 throughput will goes done if all responses need to be rewritten. • Filter Regex can control which response need to be rewritten, which will reduce the impact to performance. 10/25/2014 9

  10. Content Rewrite - Basic Control On-off Global on-off and Per Virtual service on-off Only when both the global on-off and per-VS no-off are enabled, content rewrite can work. By default, global on-off is disabled, and per Virtual service on-off is enabled. Mime Type Global setting Only the specified file types can be rewritten Files in “text/html” type are allowed to be rewritten by default. Response Code Gloabl setting Only the response with specified code can be rewritten “200” HTTP response status code is supported by default. 10/25/2014 10

  11. Content Rewrite - Rewrite Rules Global rewrite rules to rewrite the IP addresses, domain names or other strings in the Web page files into new strings as pre-defined. Two kinds of rewrite rules are supported: Only rewrite the IP addresses and domain names in the target URL of Web page files. The other strings will not be rewritten. Rewrite all the strings that match the content rewrite rule.. Limitation: The rewritten content cannot be greater than 125% of non-rewritten content. 10/25/2014 11

  12. Content Rewrite - Rewrite Rules - Example I Rule to only rewrite the “10.3.129.1” in target URL to “172.16.85.74” • The source Web page file: <p><a href="10.3.129.1">10.3.129.1</a></p> <p><a href="http://10.3.129.1/">http://10.3.129.1</a></p> <p><a href="https://10.3.129.1/">https://10.3.129.1</a></p> • The rewritten Web page file: <p><a href="172.16.85.74">10.3.129.1</a></p> <p><a href="http://172.16.85.74/">http://10.3.129.1</a></p> <p><a href="https://172.16.85.74/">https://10.3.129.1</a></p> The IP address “10.3.129.1” in the target URLs has been rewritten into “172.16.85.74”, while the IP address “10.3.129.1” in the hyperlinks remains unchanged. 10/25/2014 12

  13. Content Rewrite - Rewrite Rules Example II Rule to rewrite all the strings matches“10.3.129.1” to “172.16.85.74” • The source Web page file: <p><a href="10.3.129.1">10.3.129.1</a></p> <p><a href="http://10.3.129.1/">http://10.3.129.1</a></p> <p><a href="https://10.3.129.1/">https://10.3.129.1</a></p> • The rewritten Web page file: <p><a href="172.16.85.74">172.16.85.74</a></p> <p><a href="http://172.16.85.74/">http://172.16.85.74</a></p> <p><a href="https://172.16.85.74/">https://172.16.85.74</a></p> All the “10.3.129.1” strings have been rewritten into “172.16.85.74” 10/25/2014 13

  14. Content Rewrite - Filter Regex Permit or deny rewriting of the files that match the filter regex per virtual service • URL list • The filter regex can be defined as the extension name, the file content or a part of the file name. • Multiple filter regexes can be added into a URL list, in “OR” relationship. • URL Permit|Deny Rule • Associate the URL list with a virtual service through a permit/deny rule • The files that match any filter regex in the URL list will be rewrittenor not according to the associated permit/deny rules. 10/25/2014 14

  15. Unit 2: HTTP Content Rewrite Rules 10/25/2014 15

  16. Content Rewrite Rules Following CLI command is adding for rewrite rules support: http rewrite body rule <rule> [flags] rule– specify a rewrite rule. It can be set to the following two modes: • “ProxyHTMLURLMap from-pattern to-pattern” • “Substitute s/from-pattern/to-pattern/” • flags– specify the match mode of the strings, which can set to be “-R” or “-i”. This is an optional parameter, and the default value is null. • “-R”, the APV appliance will rewrite the string as long as part of it matches the string defined by “from-pattern”. • “-i”, the string matching with “from-pattern” is case-insensitive. • NULL, the APV appliance will rewrite the string only when the source string is fully matched with the string defined by “from-pattern”. 2014/10/25 16

  17. Content Rewrite Rule – Modes Two modes of content rewrite rule:. • “ProxyHTMLURLMap from-pattern to-pattern” • Only rewrite the IP address and domain name in the target URL of Web page files. The “from-pattern” is used to specify the source string. The “to-pattern” is used to specify the rewritten string. • Only apply to html and xhtml files. • “Substitute s/from-pattern/to-pattern/” • Rewrite all strings that match the rule. The “from-pattern” is used to specify the source string. The “to-pattern” is used to specify the rewritten string. • The source string which contains “/” character will lead to error since “/” already exists in the parameter “Substitute s/from-pattern/to-pattern/”. So in this situation we should use “Substitute s\|from-pattern\|to-pattern\|” instead. 2014/10/25 17

  18. Content Rewrite Rules– Note Notes: The configuration strings of the parameter “rule” must be framed in double quotes. The configuration strings of “ProxyHTMLURLMap” and “Substitute” are strictly case-sensitive. When both ProxyHTMLURLMap and Substitute rules are configured, the ProxyHTMLURLMap are applied firstly and then the Substitute rules are applied. And maybe even mention that Substitute rules will overwrite ProxyHTMLURLMap rules if they happen to map to the same regex. When change content rewrite rules, the content rewrite deamon will be resrarted Maximum number of rewrite rules that can be configured is 250. 10/25/2014 18

  19. Content Rewrite Rules– Examples Rewrite the “10.3.129.1” in XML page to “172.16.85.74” Turn on content rewrite on VS slb virtual http “vs1” 172.16.85.74 80 arp 0 http rewrite body on http rewrite body on vs1 Configure rewrite rule http rewrite body mimetype xml Configure rewrite rule Only rewrite the string in target URL http rewrite body rule “ProxyHTMLURLMap 10.3.129.1 172.16.85.74” -R Rewrite all the string matched http rewrite body rule “Substitute s/10.3.129.1/172.16.85.74/” -R 10/25/2014 19

  20. Unit 3: Content Rewrite Filter Regex 10/25/2014 20

  21. Content Rewrite - Filter Regex Rewritten module may do useless work if all response are sent to it By default, response to all URLs will be sent to rewritten module. In fact, some response may need not to be rewritten Rewritten module does useless work and resouce is wasted Filter Regex may reduce the useless work in rewritten module Only the responses to the URLs fit Filter Regex will be sent to rewritten module. URL list Set multiple regex string in one URL list with "or" relationship URL Permit|Deny Rule Associate one URL list with one VS through permit or deny rule. 10/25/2014 21

  22. Content Rewrite - URL list Following CLI command is adding for URL lists support: http rewrite body url list <url_list> <url_regex> url_list– specify the URL list name which should be an alphanumeric string up to 40 characters in length. Special characters like “,\t:+&#%$^()!@~*?"<>=|\\/\” are not allowed for this parameter. url_regex– specify the filter regex to be added into the URL list An alphanumeric string up to 1024 characters in lengt. It supports a simple regular expression: where “^” matches the beginning of the URL, “*” means any sequence of 0 or more characters and “$” matches the end of the URL. Multiple filter regexes can be added into one URL list, in “OR” relationship. That is to say, the permit/deny rule will work as long as any of the extension name, file name or file contents matches the filter regex. 10/25/2014 22

  23. Content Rewrite - URL Permit|Deny Rule Following CLI command associates the URL list with a virtual servicthrough a permit/deny rule http rewrite body url permit|deny <virtual_name> <url_list> virtual_name – specify a virtual service url_list– specify a pre-defined URL list Only one URL list can be associated with one VS through permit or deny rule. If no URL list is associated with the VS, all theURLs are allowed to rewritten. If a permit rule is associated with the VS, the default behavior is deny, only the URL hits permit URL lists can be rewritten. If a deny rule is associated with the VS, the default behavior is permit, only the URL hits permit URL lists cannot be rewritten. 10/25/2014 23

  24. Content Rewrite - Filter Regex Example • Define URL list http rewrite body url url_list1 "index" http rewrite body url ulr_list1 "test*.html" http rewrite body url url_list2 "aaa" • Deny url_list1 on vs1 http rewrite body url deny url_list1 vs1 E.g: http://index.htm <== not to be rewritten http://test1.html <==not to be rewritten http://default.html <==to be rewritten • Permit url_list2 on vs2 http rewrite body url permit url_list2 vs2 E.g: http://aaa.html <==to be rewritten http://default.htm <== not to be rewritten 10/25/2014 24

  25. 10/25/2014 Unit 4: Content Rewrite CLI &WebUI 25

  26. Content Rewrite CLI - onoff Following CLI command turn on-off content rewrite feature. http rewrite body {on|off} [virtual_name] • virtual_name – sepcify the virtual service name to enable/disable the HTTP Content Rewrite function for it. If it is not set, the HTTP Content Rewrite function will be enabled/disabled globally. Note: 1.By default, the HTTP content rewrite function is disabled globally, while enabled per virtual service. 2. Only with the global HTTP content rewrite enabled, will the per virtual service HTTP content rewrite enabling and configurations take effect. 2014/10/25 26

  27. Content Rewrite CLI - mimetype Following CLI command was changed for adding file type to be rewritten. http rewrite body mimetype <mime_type> • mime_type – specify the file type to be rewritten. It can be set to be the following type: html, plain, richtext, xml, xhtml, css or js. By default, the APV appliance only rewrites the “text/html” file type. 2014/10/25 27

  28. Content Rewrite CLI - statuscode Following CLI command was changed for adding status code of response to be rewritten. http rewrite body statuscode <response_code> • response_code – specify an HTTP response status code. Only the Web page files that contain the specified status code will be rewritten. By default, the APV appliance only rewrites the Web page files with the “200” HTTP response status code. 2014/10/25 28

  29. Content Rewrite WebUI - General Setting 2014/10/25 29

  30. Content Rewrite WebUI - Rewrite Rule I 2014/10/25 30

  31. Content Rewrite WebUI - Rewrite Rule II 2014/10/25 31

  32. Content Rewrite WebUI - Rewrite List I 2014/10/25 32

  33. Content Rewrite WebUI - Rewrite List II 2014/10/25 33

  34. Content Rewrite WebUI - Rewrite List III 2014/10/25 34

  35. Thank you

More Related