Citrix ADC

重写和响应器策略示例

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

例1:通过命令行接口添加本地Client-IP头

添加重写动作act_ins_client insert_http_header NS-Client的CLIENT.IP。SRC添加重写策略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…*连接到10.10.10.10(10.10.10.10)端口80 (# 0)> / testsite file5.html HTTP / 1.1 > user - agent:旋度/ 7.35.0 >主持人:10.10.10.10 >接受 : */* > < HTTP / 1.1 200 OK <日期:星期二,2020年11月10 10:06:48格林尼治时间*服务器Apache / 2.2.15 (CentOS)不是黑名单<服务器:Apache / 2.2.15 (CentOS) < last - modified:星期四,6月2019 07:16:04格林尼治时间< 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服务器类型

替换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…*连接到10.10.10.10(10.10.10.10)端口80 (# 0)> / testsite file5.html HTTP / 1.1 > user - agent:旋度/ 7.35.0 >主持人:10.10.10.10 >接受 : */* > < HTTP / 1.1 200 OK <日期:星期二,2020年11月10 10:15:42格林尼治时间*服务器Web Server 1.0不是黑名单<服务器:Web服务器1.0 < last - modified:星期四,6月2019 07:16:04格林尼治时间< 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时,通过重定向到不同的url进行响应

>添加响应器动作act1 redirect”\“www.google.com \“做>添加应答策略pol1”HTTP.REQ.URL.CONTAINS(“文件”)“act1 >绑定完成应答器全球pol1 1做>名称:~ $ curl http://10.10.10.10/testsite/file5.html - v *在DNS缓存主机名不存在*尝试10.10.10.10……*连接到10.10.10.10(10.10.10.10)端口80 (# 0)> / testsite file5.html HTTP / 1.1 > user - agent:旋度/ 7.35.0 >主持人:10.10.10.10 >接受 : */* > < HTTP / 1.1 302发现:暂时搬到<位置:www.google.com <连接:紧密< cache - control: no - cache <编译指示:no - cache < *关闭连接0 name@obelix: ~ $ < !——NeedCopy >

示例4:用消息响应,消息可以是任何表达式,也可以是文本

添加响应器动作act123以“\”请联系管理员应对\”“添加应答策略pol1”HTTP.REQ.URL.CONTAINS(\“文件\”)“act123绑定响应器100年全球pol1 name@obelix: ~ $ curl http://10.10.10.10/testsite/file5.html - v *主机名不存在在DNS缓存*尝试10.10.10.10 . .>add Responder Action redirect -Action redirect "https://xyz.abc.com/dispatcher/SAML2AuthService?siteurl=wmav\"" -responseStatusCode 302 >add Responder Policy redirect "HTTP.REQ.HOSTNAME.CONTAINS(\"abc\")"Redirect-Action绑定LB虚拟服务器:>bind LB vserver Test1_SF -policyName Redirect-Policy -priority 100 - gotopriityexpression END -type REQUEST。* connect 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——NeedCopy >

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

进口响应者htmlpage http://10.10.10.10) / testsite file5.html page112添加响应器动作act1 respondwithHtmlpage page1添加应答策略pol1真正act1绑定响应器100年全球pol1 name@obelix: ~ $ curl - v http://10.10.10.10) / testsite / file5.html *在DNS缓存主机名不存在*尝试10.10.10.10……*连接到10.10.10.10(10.10.10.10))端口80 (# 0)> / testsite file5.html HTTP / 1.1 > user - agent:旋度/ 7.35.0 >主持人:10.102.58.140 >接受 : */* > < HTTP / 1.1 200 OK <内容长度:5 <的content - type: text / html < # 0 *连接主机10.10.10.10留下完整JLEwxt_name@obelix: ~ $ < !——NeedCopy >

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

>add Responder Action redirect -Action redirect "https://xyz.abc.com/dispatcher/SAML2AuthService?siteurl=wmav\"" -responseStatusCode 302 >add Responder Policy redirect "HTTP.REQ.HOSTNAME.CONTAINS(\"abc\")"Redirect-Action绑定LB虚拟服务器:>bind LB vserver Test1_SF -policyName Redirect-Policy -priority 100 - gotopriityexpression END -type REQUEST