Forum Discussion
TLL_91858
Cirrus
Feb 28, 2008Any way to read the CGI collection?
I am trying to use items from the CGI variable collection, but can't seem to find a way to read, for instance CGI.REMOTE_USER variable.
Anyone know of a way to use these in an iRule?
hoolio
Cirrostratus
Feb 28, 2008I assume remote user is the base64 encoded value in the Authorization header. If so, you can use HTTP::header value Authorization to get the header value, decode it using b64decode and then split the value on the decoded colon:
set auth_value [HTTP::header value Authorization]
set decoded_auth_value [b64decode $auth_value]
set user [getfield $decoded_auth_field 1]
set pass [getfield $decoded_auth_field 2]
or:
set user [getfield [b64decode [HTTP::header value Authorization] 1]
set pass [getfield [b64decode [HTTP::header value Authorization] 2]
Most of the other CGI variables are available using various commands:
- client IP address and port: [IP::client_addr] and [TCP::client_port]
- VIP IP and port by using [IP::local_addr] and [TCP::local_port] in a client side event
- request method: [HTTP::method
- path: [HTTP::path]
- URI: [HTTP::uri]
- query string: [HTTP::query]
- content type: [HTTP::header value Content-Type]
- content length: [HTTP::header value Content-Length]
For details on the commands, you can check the corresponding wiki pages:
http://devcentral.f5.com/wiki/Default.aspx/iRules.HomePage (Click here)
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects