<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Insert Source IP to an already loadbalanced HTTP Traffic or if the XFF already exists in Data Center and Cloud Knowledge Base</title>
    <link>https://community.cisco.com/t5/data-center-and-cloud-knowledge-base/insert-source-ip-to-an-already-loadbalanced-http-traffic-or-if/ta-p/3127041</link>
    <description>&lt;P&gt;&lt;LI-TOC indent="15" liststyle="disc" maxheadinglevel="2"&gt;&lt;/LI-TOC&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Introduction&lt;/H2&gt;&lt;P&gt;In Cisco ACE configuration Real servers are dedicated physical servers that you typically configure in groups called server farms. Server farms are groups of networked real servers that contain the same content and that typically reside in the same physical location in a data center. Web sites often comprise groups of servers configured in a server farm. Load-balancing software distributes client requests for content or services among the real servers based on the configured policy and traffic classification, server availability and load, and other factors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTTP header insertion is used to identify the original source IP address of SNATed packet. The X-Forwarded-For (XFF) HTTP header field is a de facto standard for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Insert or Modify HTTP Header&lt;/H2&gt;&lt;P&gt;The ACE is able to insert or modify HTTP header using an Layer 7 policy. This is mentioned in detail in the &lt;A href="http://www.cisco.com/en/US/docs/interfaces_modules/services_modules/ace/vA5_1_0/configuration/slb/guide/classlb.html#wp1131842" rel="nofollow" target="_blank"&gt;configuration guide&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a sample config which will insert a header with the src IP, as per SLB configuration guide:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;action-list type modify http HTTP-INSERT-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp; header insert request ISPx-HEADER-CLIENTSRCIP header-value %is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;policy-map type loadbalance http first-match PUBLICBASIC-001-SLB01-POLICYMAP&lt;/P&gt;&lt;P&gt;&amp;nbsp; class class-default&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sticky-serverfarm SRC-IP-STICKY-SRVFARM-01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; action HTTP-INSERT-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, the src IP gets inserted into a header called ISPx-HEADER-CLIENTSRCIP. Alternatively, one can name the header “X-Forwarded-For” to comply with the standard instead of “ISPx-HEADER-CLIENTSRCIP”. But in case some other proxy has already set the “X-Forwarded-For” header before; then the ACE would add another header with the same name instead of inserting the IP in the existing header (this is the expected behavior for the “header insert” command). Some servers will then concatenate the content of identical headers to form a chain of Source IPs (eg: Apache), some won’t.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Insert Source IP to an existing XFF list&lt;/H2&gt;&lt;P&gt;To add the source IP to an already existing list of XFF IP addresses instead, the command “header rewrite” action should be used on the ACE:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;header rewrite request X-Forwarded-For header-value "(.*)" replace "%1, %is"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But because this “header rewrite” action would only work if the header already exists, the SLB policy would first need to have a class to check whether the header is present or not before it decides to do either an insert or a rewrite. The configuration would become:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;class-map type http loadbalance match-all EXISTING-XFF-HEADER-CLASSMAP&lt;/P&gt;&lt;P&gt;&amp;nbsp; 5 match http header X-Forwarded-For header-value ".*"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;action-list type modify http HTTP-INSERT-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp; header insert request X-Forwarded-For header-value %is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;action-list type modify http HTTP-REWRITE-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp; header rewrite request X-Forwarded-For header-value "(.*)" replace "%1, %is"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;policy-map type loadbalance http first-match PUBLICBASIC-001-SLB01-POLICY&lt;/P&gt;&lt;P&gt;&amp;nbsp; class EXISTING-XFF-HEADER-CLASSMAP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sticky-serverfarm SRC-IP-STICKY-SRVFARM-01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; action HTTP-REWRITE-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp; class class-default&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sticky-serverfarm SRC-IP-STICKY-SRVFARM-01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; action HTTP-INSERT-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Verify&lt;/H2&gt;&lt;P&gt;One should test for a header insertion followed by a header rewrite to validate both behaviors as working. This could be done with a scenario where you have multi-tiered load-balancing where the first tier does an insert because no XFF header is present, and a second tier does a rewrite after detecting the header is present.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could use a packet dump on the rservers to validate the header insertion / rewrite.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Related Information&lt;/H2&gt;&lt;P&gt;&lt;A href="https://community.cisco.com/document/88456/health-monitoring-best-practices-cisco-ace" target="_blank"&gt;Health Monitoring Best Practices for Cisco ACE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cisco.com/document/91051/management-features-and-capabilities-ace-appliance" target="_blank"&gt;Management Features and Capabilities on ACE appliance&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://supportforums.cisco.com/document/81676/insert-www-url-client-request-using-ace" target="_blank"&gt;Insert WWW in the URL of client request using ACE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://supportforums.cisco.com/document/111856/load-balance-multiple-networks-ace-sharing-common-vlan" target="_blank"&gt;Load Balance Multiple Networks on ACE Sharing a Common VLAN&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Aug 2017 11:38:54 GMT</pubDate>
    <dc:creator>Sandeep Singh</dc:creator>
    <dc:date>2017-08-29T11:38:54Z</dc:date>
    <item>
      <title>Insert Source IP to an already loadbalanced HTTP Traffic or if the XFF already exists</title>
      <link>https://community.cisco.com/t5/data-center-and-cloud-knowledge-base/insert-source-ip-to-an-already-loadbalanced-http-traffic-or-if/ta-p/3127041</link>
      <description>&lt;P&gt;&lt;LI-TOC indent="15" liststyle="disc" maxheadinglevel="2"&gt;&lt;/LI-TOC&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Introduction&lt;/H2&gt;&lt;P&gt;In Cisco ACE configuration Real servers are dedicated physical servers that you typically configure in groups called server farms. Server farms are groups of networked real servers that contain the same content and that typically reside in the same physical location in a data center. Web sites often comprise groups of servers configured in a server farm. Load-balancing software distributes client requests for content or services among the real servers based on the configured policy and traffic classification, server availability and load, and other factors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTTP header insertion is used to identify the original source IP address of SNATed packet. The X-Forwarded-For (XFF) HTTP header field is a de facto standard for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Insert or Modify HTTP Header&lt;/H2&gt;&lt;P&gt;The ACE is able to insert or modify HTTP header using an Layer 7 policy. This is mentioned in detail in the &lt;A href="http://www.cisco.com/en/US/docs/interfaces_modules/services_modules/ace/vA5_1_0/configuration/slb/guide/classlb.html#wp1131842" rel="nofollow" target="_blank"&gt;configuration guide&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a sample config which will insert a header with the src IP, as per SLB configuration guide:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;action-list type modify http HTTP-INSERT-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp; header insert request ISPx-HEADER-CLIENTSRCIP header-value %is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;policy-map type loadbalance http first-match PUBLICBASIC-001-SLB01-POLICYMAP&lt;/P&gt;&lt;P&gt;&amp;nbsp; class class-default&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sticky-serverfarm SRC-IP-STICKY-SRVFARM-01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; action HTTP-INSERT-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, the src IP gets inserted into a header called ISPx-HEADER-CLIENTSRCIP. Alternatively, one can name the header “X-Forwarded-For” to comply with the standard instead of “ISPx-HEADER-CLIENTSRCIP”. But in case some other proxy has already set the “X-Forwarded-For” header before; then the ACE would add another header with the same name instead of inserting the IP in the existing header (this is the expected behavior for the “header insert” command). Some servers will then concatenate the content of identical headers to form a chain of Source IPs (eg: Apache), some won’t.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Insert Source IP to an existing XFF list&lt;/H2&gt;&lt;P&gt;To add the source IP to an already existing list of XFF IP addresses instead, the command “header rewrite” action should be used on the ACE:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;header rewrite request X-Forwarded-For header-value "(.*)" replace "%1, %is"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But because this “header rewrite” action would only work if the header already exists, the SLB policy would first need to have a class to check whether the header is present or not before it decides to do either an insert or a rewrite. The configuration would become:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;class-map type http loadbalance match-all EXISTING-XFF-HEADER-CLASSMAP&lt;/P&gt;&lt;P&gt;&amp;nbsp; 5 match http header X-Forwarded-For header-value ".*"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;action-list type modify http HTTP-INSERT-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp; header insert request X-Forwarded-For header-value %is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;action-list type modify http HTTP-REWRITE-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp; header rewrite request X-Forwarded-For header-value "(.*)" replace "%1, %is"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;policy-map type loadbalance http first-match PUBLICBASIC-001-SLB01-POLICY&lt;/P&gt;&lt;P&gt;&amp;nbsp; class EXISTING-XFF-HEADER-CLASSMAP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sticky-serverfarm SRC-IP-STICKY-SRVFARM-01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; action HTTP-REWRITE-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp; class class-default&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sticky-serverfarm SRC-IP-STICKY-SRVFARM-01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; action HTTP-INSERT-XFF-HEADER-SRCIP-ACTIONLIST&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Verify&lt;/H2&gt;&lt;P&gt;One should test for a header insertion followed by a header rewrite to validate both behaviors as working. This could be done with a scenario where you have multi-tiered load-balancing where the first tier does an insert because no XFF header is present, and a second tier does a rewrite after detecting the header is present.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could use a packet dump on the rservers to validate the header insertion / rewrite.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Related Information&lt;/H2&gt;&lt;P&gt;&lt;A href="https://community.cisco.com/document/88456/health-monitoring-best-practices-cisco-ace" target="_blank"&gt;Health Monitoring Best Practices for Cisco ACE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cisco.com/document/91051/management-features-and-capabilities-ace-appliance" target="_blank"&gt;Management Features and Capabilities on ACE appliance&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://supportforums.cisco.com/document/81676/insert-www-url-client-request-using-ace" target="_blank"&gt;Insert WWW in the URL of client request using ACE&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://supportforums.cisco.com/document/111856/load-balance-multiple-networks-ace-sharing-common-vlan" target="_blank"&gt;Load Balance Multiple Networks on ACE Sharing a Common VLAN&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2017 11:38:54 GMT</pubDate>
      <guid>https://community.cisco.com/t5/data-center-and-cloud-knowledge-base/insert-source-ip-to-an-already-loadbalanced-http-traffic-or-if/ta-p/3127041</guid>
      <dc:creator>Sandeep Singh</dc:creator>
      <dc:date>2017-08-29T11:38:54Z</dc:date>
    </item>
  </channel>
</rss>

