Jump to content
Welcome to our new Citrix community!

Insert Header based on Back-end Server chosen on Citrix ADC


Manoranjan kumar

Recommended Posts

I am doing one deployment where i need to insert some header into the request based on the back-end server chosen .

I am not able to find an expression which i Can use to insert that header based on the back-end server chosen .

I have Apache load baalncer configuration with me but i am not able to find anything related to this on Netscaler.

can some please help urgently ?

 

Header add Set-Cookie "SERVERID=.%{BALANCER_WORKER_ROUTE}e; path=/3ddashboard"
ProxyHCExpr ok23 {%{REQUEST_STATUS} =~ /^[23]/}
<Proxy balancer://mycluster>
BalancerMember "http://server01:9020/3ddashboard" route=dashboard1 hcmethod=OPTIONS hcexpr=ok23 hcuri=/3ddashboard/test-alive hcinterval=10 hcpasses=1 hcfails=1
BalancerMember "http://server02:9020/3ddashboard" route=dashboard2 hcmethod=OPTIONS hcexpr=ok23 hcuri=/3ddashboard/test-alive hcinterval=10 hcpasses=1 hcfails=1
ProxySet lbmethod=bytraffic
ProxySet stickysession=SERVERID>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>persistence chosen
# set x-dsp-client-node header based on route taken>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>based on what back-end server chosen 
SetEnvIf Cookie "SERVERID=DASH.1" TARGET_POOL=1
SetEnvIf Cookie "SERVERID=DASH.2" TARGET_POOL=2
RequestHeader add x-dsp-client-node DASH.%{TARGET_POOL}e>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

Can we replicate above logic on netscaler somehow ?

 

This is related to Dassault 3DEX application for which no reference document is available with Citrix or Dassaut .

We are deploying this application on Netscaler and facing some difficulty .

 

Link to comment
Share on other sites

17 hours ago, Mihai Cziraki1709160741 said:

i don't know if this helps you:

 

add rewrite action test insert_http_header x-dsp-client-node SERVER.IP.DST

Thanks Mihai but what i am looking for is that if we have 2 servers and we want to insert cokkie value based on the server chosen with the above header .

SO when X back-end server is chosen , request should insert x-dsp-client-node and value is cookie value for that back-end server .

When Y back-end server is chosen , request should go with header x-dsp-client-node with cookie value for that server .

Link to comment
Share on other sites

On 11/14/2019 at 10:15 AM, Mihai Cziraki1709160741 said:

Hello Mihai ,

 

I already checked this .But what i am intrested in knowing how we can insert certain header with certain value based on on back-end server chosen .

Lets say there are 2 back-end server X and Y .

When server X is chosen , it should insert the Header with value A and when server Y is chosen is chosen it should insert header with value B .

Link to comment
Share on other sites

The problem with what you are trying to do is that the rewite actions are calculated BEFORE the traffic is actually load-balanced, so you can't rewrite the headers based on where the LB is sending the traffic :-(

 

Now, if you were able to use a Content Switch to do the loadbalancing (see below) then a rewrite on each LBVS would work (as rewrite happens AFTER Content Switching!).

 

This came up on the forums before, where the poster wanted to send 10% of the traffic to a test service, and also rewrite the host header. He used a CSVserver, with a policy that looked at the system time: if the units of seconds was a zero, send it to the "test" LBVS, and if 1 to 9, send it to the "Prod" LBVS. Then bind the rewrite polict ot the "test" LBVS. So, for 1 second every 10, the traffic went one way, for the other 9 it went the other.

 

Maybe you can do something similar?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...