Subscriptions: Video  |  Audio  |  Tutorials  |  Tech Tips  |  Features  |  More...

Current Articles | Categories | Search | Syndication

by naladar - 1668 views Article Rating

I recently had the pleasure of working on a Citrix 5.0 implementation and I wanted to share a few things that I learned during that setup.  As many of you know, there are two deployment guides that have been made available by F5 Networks in regards to setting up Citrix Presentation Server 4.5 in TMOS versions 9.x and 10.x.  They are excellent guides and the best thing about them is that you can utilize those guides to assist you in deploying Citrix XenApp 5.0, with a few exceptions of course.  Those exceptions are what I will be covering in this tech tip.

Both of the previously mentioned deployment guides discuss editing files on the Citrix farms Web Interface servers so that it looks for the client IP address in the X-Forwarded-For HTTP header.  Otherwise, every connection will appear to be originating from the BIG-IP LTM and not from its true IP.  After reading both guides and looking at my current environment I was dismayed to find that the files and locations mentioned were no longer valid.  I then turned to my top three resources on the web in the search for an answer: AskF5, DevCentral and Google. 

I struck out on the first two (which seldom happens) but my Google search did turn up some interesting results on the Citrix Forums.  I finally found some code posted by Sam Jacobs back in August 2009 that modifies the way the Citrix farm looks up the client IP address.  His method allows for the use of the X-Forwarded-For header.

The first file that you will want to find and edit is the Include.java file.  You will want to locate and change this file on every Web Interface XenApp server in the farm.  Speaking from experience, save a copy of the original file to a safe location such as your desktop or flash drive.  DO NOT copy the file and rename the original to Include.old and leave it on the server.  It may sound crazy, but doing that will not work.  I’m not a programmer, so I cannot tell you why that will not work, but I can tell you I know for a fact it will not.  That being said, here is the file path for the Include.java file:

“\Inetpub\wwwroot\Citrix\XenApp\app_code\PagesJava\com\citrix\wi\pageutils\Include.java”

Now that you have found the file, open it up with a text editor (I use Textpad) and find the Java routine named “getClientAddress”.  Replace the code for that routine with the code listed below.

public static String getClientAddress(WIContext wiContext) {
String ageClientAddress = AGEUtilities.getAGEClientIPAddress(wiContext);
String userIPAddress = wiContext.getWebAbstraction().getRequestHeader("X-FORWARDED-FOR");
if (userIPAddress == null) {
userIPAddress = wiContext.getWebAbstraction().getUserHostAddress();
}
return (ageClientAddress != null ? ageClientAddress : userIPAddress);
}

Save the file and wash/rinse/repeat this step on every Web Interface server in the farm.  The next thing that you will want to do is to modify the login page so that it displays the client IP address being obtained from the X-Forwarded-For header.  The file you will want to edit is called “loginView.ascx” and can be found in the following file path on your Web Interface Servers:

”\inetpub\wwwroot\Citrix\XenApp\app_data\include\loginView.ascx”

The code you will want to add is:

Client IP: <%= com.citrix.wi.pageutils.Include.getClientAddress(wiContext) %>

I added the code directly below the LoginPageControl viewControl line and it works well for me.  Save the file and repeat this step on every Web Interface server in the farm and reboot each Web Interface Server after you are done. 

That’s it!  Well, you do have to complete the other setup steps listed in the deployment guide that you are using, but after that your farm will be ready for business!  I am aiming to develop some custom monitors for the Web Interface Server and for the XML Broker Servers over the next few weeks.  Once I have those done I will put them out in the forums for the community enjoy.

-naladar


Rate This Article:

COMMENTS

Hello naladar. Thanks very much for the post! I have not tried your suggestions yet but will as time permits. Looks great. -Jim

posted @ Monday, March 01, 2010 6:07 AM by jlooney3@csc.com


Thanks for your post mate! I've been hunting for this. I even asked an F5 consultant who came into the office, and it looks like they don't have the healthiest relationships with Citrix so to find code that fixes stuff, is easier said than done. So...nice one! Testing it now.

posted @ Wednesday, March 10, 2010 6:01 AM by oopiyo


We are in process of deploying WI through F5 , we are trying to assign custom monitors for the Web Interface, i would appreciate if you could post your finding on creating custom F5 monitor for WI.

Thanks
David

posted @ Wednesday, March 10, 2010 10:33 AM by david1


Nice info, naladar!

If you're using the client IP parsed from the X-Forwarded-For header for anything other than reporting, it would make sense to have LTM remove any previous X-Forwarded-For instances by setting the HTTP profile option to: 'Request Header Erase: X-Forwarded-For'.

Aaron

posted @ Thursday, March 11, 2010 4:54 AM by hoolio


Audio
Validating Data Group (Class) References
v10.1 - Configuring GTM's DNS Security Extensions
v.10 - Remote Authorization via TACACS+
v.10 - New class features in iRules
v.10 - iRules and the after command
v.10 - FastHTTP and Cookie Persistence
v.10 - A new iRules Namespace
Unbind your LDAP servers with iRules
Ten Steps to iRules Optimization
Tech Tip: Saving Your iControl Changes
Switch Gone Wild: Using Wildcards with the Tcl "switch" command
Stacking iRules: A Modular Approach
SNMP: Capturing SSL Statistics per Virtual Server
Selective DNS Persistence on GTM
Ruby Meets iControl: Switching Policies
Ruby meets iControl: Making Wide IPs
Ruby meets iControl: Creating VIPs
Rewriting Redirects
Replacing the WebSphere Apache Plugin with iRules
RADIUS Load Balancing with iRules
Polymorphism - Making TCL operators work for you
Persisting SSL Connections
Persisting Across Virtual Servers
Passive Application Monitoring with LTM
Monitoring TCP Applications #01
Managing The System Boot Location with iControl
LTM: Per-VLAN Default Gateways
LTM: Dueling Timeouts
LTM: Configuring IP Forwarding
LTM: Action on Service Down
iRules: Disabling Event Processing
iRules Update: New options for the "log" command
iRules Optimization 101 - #05 - Evaluating iRule Performance
iRules Optimization 101 - #04 - Delimiters: Braces, Brackets, Quotes and more
iRules Optimization 101 - #03 - for vs. foreach
iRules Optimization 101 - #02 - Expressions and Variables
iRules Optimization 101 - #01 - if, elseif and switch
iRules Event Order
iRules 101 - #15 - TCL List Handling Commands
iRules 101 - #14 - TCL String Commands Part 2
iRules 101 - #13 - TCL String Commands Part 1
iRules 101 - #12 - Validating Your Logic
iRules 101 - #11 - Events
iRules 101 - #10 - Regular Expressions
iRules 101 - #09 - Debugging
iRules 101 - #08 - Classes
iRules 101 - #07 - Catch
iRules 101 - #06 - When
iRules 101 - #05 - Selecting Pools, Pool Members, and Nodes
iRules 101 - #04 - Switch
iRules 101 - #03 - Variables
iRules 101 - #02 - If and Expressions
iRules 101 - #01 - Introduction to iRules
iRule Security 101 - #09 - Command Execution
iRule Security 101 - #08 - Limiting POST Data
iRule Security 101 - #07 - FTP Proxy
iRule Security 101 - #06 - HTTP Referer
iRule Security 101 - #05 - Avoiding Path Traversal
iRule Interference: Custom Closes and Responses
Investigating the LTM TCP Profile: Windows & Buffers
Investigating the LTM TCP Profile: The Finish Line
Investigating the LTM TCP Profile: Nagle’s Algorithm
Investigating the LTM TCP Profile: ECN & LTR
Investigating the LTM TCP Profile: Congestion Control Algorithms
Investigating the LTM TCP Profile: Acknowledgements
iControl Concept to Implementation (iC2I): The Introduction.
iControl Apps - #18 - Virtual Server Reverse Lookup
iControl Apps - #14 - Global Statistics
iControl Apps - #13 - System PVA Statistics
iControl Apps - #12 - Global SSL Statistics
iControl Apps - #11 - Global GTM Statistics
iControl Apps - #10 - Bigpipe List
iControl Apps - #09 - TMM Statistics
iControl Apps - #08 - System IP Statistics
iControl Apps - #07 - System Http Statistics
iControl Apps - #06 - Configuration Archiving
iControl Apps - #05 - Rate Based Statistics
iControl Apps - #04 - Graceful Server Shutdown
iControl Apps - #03 - Local Traffic Map
iControl Apps - #02 - Local Traffic Summary
iControl Apps - #01 - Disabling Node Servers
iControl 101 - #22 - GTM Data Centers
iControl 101 - #21 - Rate Classes
iControl 101 - #20 - Port Lockdown
iControl 101 - #19 - Time Conversions
iControl 101 - #18 - Stream Profile
iControl 101 - #17 - PortMirror
iControl 101 - #16 - SelfIPs
iControl 101 - #15 - System Services
iControl 101 - #14 - License Administration
iControl 101 - #13 - Data Groups
iControl 101 - #12 - Database Variables
iControl 101 - #11 - Performance Graphs
iControl 101 - #10 - System Inet
iControl 101 - #09 - iRules
iControl 101 - #08 - Partitions
iControl 101 - #07 - User Management
iControl 101 - #06 - File Transfer APIs
iControl 101 - #05 - Exceptions
iControl 101 - #04 - Language Options
iControl 101 - #03 - iControl Taxonomy
iControl 101 - #02 - How iControl Works
iControl 101 - #01 - iControl Marketing Dissected
iC2I: Automation - Creating Virtuals Simplified.
GTM, Know Thyself
Getting Started with pyControl
FTPS Offload via iRules
Exchange Persistence Duality and iRules
Dynamic WSDL updating with iRules
Custom SNMP Traps
Creating An iControl PowerShell Monitoring Dashboard With Google Charts
Cookie LoJack vi iRules
Content-Disposition - Forced file downloads via HTTP
Concurrent iControl Programming Explained
Case Insensitive Comparisons
Can iRules fix my cert mismatch errors?
Cache in with LTM and iRules
Building a Custom WebAccelerator Policy
Automated Web Analytics iRule Style
Investigating the LTM TCP Profile: Max Syn Retransmissions & Idle Timeout