ADC
感谢您提供反馈

这篇文章已经过机器翻译.放弃

重写和响应者策略示例

以下是重写和响应程序策略的一些示例:

示例 1:使用命令行界面添加本地 Client-IP 标头

add rewrite action act_ins_client insert_http_header NS-Client 'CLIENT.IP.SRC' add rewrite policy pol_ins_client http.req.is_valid act_ins_client bind rewrite global pol_ins_client 300 END namem@obelix:~$ curl -v http://10.10.10.10/testsite/file5.html * Hostname was NOT found in DNS cache * Trying 10.10.10.10... * Connected to 10.10.10.10 (10.10.10.10) port 80 (#0) > GET /testsite/file5.html HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 10.10.10.10 > Accept: \*/\* > < HTTP/1.1 200 OK < Date: Tue, 10 Nov 2020 10:06:48 GMT * Server Apache/2.2.15 (CentOS) is not blacklisted < Server: Apache/2.2.15 (CentOS) < Last-Modified: Thu, 20 Jun 2019 07:16:04 GMT < ETag: "816c5-5-58bbc1e73cdd3" < Accept-Ranges: bytes < Content-Length: 5 < Content-Type: text/html; charset=UTF-8 < NS-Client: 10.102.1.98 < * Connection #0 to host 10.10.10.10 left intact JLEwxt_namem@obelix:~$

示例 2:掩盖 HTTP 服务器类型

add rewrite action Action-Rewrite-Server_Mask REPLACE HTTP.RES.HEADER("Server") ""Web Server 1.0"" add rewrite policy-Rewrite-Server_Mask HTTP.RES.IS_VALID Action-Rewrite-Server_Mask NOREWRITE namem@obelix:~$ curl -v http://10.10.10.10/testsite/file5.html * Hostname was NOT found in DNS cache * Trying 10.10.10.10... * Connected to 10.10.10.10 (10.10.10.10) port 80 (#0) > GET /testsite/file5.html HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 10.10.10.10 > Accept: \*/\* > < HTTP/1.1 200 OK < Date: Tue, 10 Nov 2020 10:15:42 GMT * Server Web Server 1.0 is not blacklisted < Server: Web Server 1.0 < Last-Modified: Thu, 20 Jun 2019 07:16:04 GMT < ETag: "816c5-5-58bbc1e73cdd3" < Accept-Ranges: bytes < Content-Length: 5 < Content-Type: text/html; charset=UTF-8 < * Connection #0 to host 10.10.10.10 left intact JLEwxt_namem@obelix:~$

示例 3:收到网址时通过重定向到不同的 URL 进行响应

> add responder action act1 redirect ""www.google.com"" Done > add responder policy pol1 'HTTP.REQ.URL.CONTAINS("file")' act1 Done > bind responder global pol1 1 Done > name:~$ curl -v http://10.10.10.10/testsite/file5.html * Hostname was NOT found in DNS cache * Trying 10.10.10.10... * Connected to 10.10.10.10 (10.10.10.10) port 80 (#0) > GET /testsite/file5.html HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 10.10.10.10 > Accept: \*/\* > < HTTP/1.1 302 Found : Moved Temporarily < Location: www.google.com < Connection: close < Cache-Control: no-cache < Pragma: no-cache < * Closing connection 0 name@obelix:~$

示例 4:使用可以是任何表达式或文本的消息进行回应

add responder action act123 respondwith ""Please reach out to administrator"" add responder policy pol1 "HTTP.REQ.URL.CONTAINS("file")" act123 bind responder global pol1 100 END name@obelix:~$ curl -v http://10.10.10.10/testsite/file5.html * Hostname was NOT found in DNS cache * Trying 10.10.10.10..Responder Action and Policy: >add responder action Redirect-Action redirect ""https://xyz.abc.com/dispatcher/SAML2AuthService?siteurl=wmav"" -responseStatusCode 302 >add responder policy Redirect-Policy "HTTP.REQ.HOSTNAME.CONTAINS("abc")" Redirect-Action Binding to LB Virtual Server: >bind lb vserver Test1_SF -policyName Redirect-Policy -priority 100 -gotoPriorityExpression END -type REQUEST. * Connected to 10.10.10.10 (10.10.10.10) port 80 (#0) > GET /testsite/file5.html HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 10.10.10.10 > Accept: \*/\* > * Connection #0 to host 10.10.10.10 left intact Please reach out to administratort_name@obelix:~$

示例 5:使用 HTML 导入的页面进行响应

import responder htmlpage http://10.10.10.10)/testsite/file5.html page112 add responder action act1 respondwithHtmlpage page1 add responder policy pol1 true act1 bind responder global pol1 100 name@obelix:~$ curl -v http://10.10.10.10)/testsite/file5.html * Hostname was NOT found in DNS cache * Trying 10.10.10.10... * Connected to 10.10.10.10 (10.10.10.10)) port 80 (#0) > GET /testsite/file5.html HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 10.102.58.140 > Accept: \*/\* > < HTTP/1.1 200 OK < Content-Length: 5 < Content-Type: text/html < * Connection #0 to host 10.10.10.10 left intact JLEwxt_name@obelix:~$

示例 6:使用响应程序策略基于主机名重定向 URL

Responder Action and Policy: >add responder action Redirect-Action redirect ""https://xyz.abc.com/dispatcher/SAML2AuthService?siteurl=wmav"" -responseStatusCode 302 >add responder policy Redirect-Policy "HTTP.REQ.HOSTNAME.CONTAINS("abc")" Redirect-Action Binding to LB Virtual Server: >bind lb vserver Test1_SF -policyName Redirect-Policy -priority 100 -gotoPriorityExpression END -type REQUEST
本内容的正式版本为英文版。部分 Cloud Software Group 文档内容采用了机器翻译,仅供您参考。Cloud Software Group 无法控制机器翻译的内容,这些内容可能包含错误、不准确或不合适的语言。对于从英文原文翻译成任何其他语言的内容的准确性、可靠性、适用性或正确性,或者您的 Cloud Software Group 产品或服务沿用了任何机器翻译的内容,我们均不作任何明示或暗示的保证,并且适用的最终用户许可协议或服务条款或者与 Cloud Software Group 签订的任何其他协议(产品或服务与已进行机器翻译的任何文档保持一致)下的任何保证均不适用。对于因使用机器翻译的内容而引起的任何损害或问题,Cloud Software Group 不承担任何责任。