Forum Discussion
Andy_Shaw_55687
Nimbostratus
Feb 23, 2009NAME_RESOLVED not firing
Dear Forum,
I'm trying to get DNS resolution working from within an iRule in v9.4.6.
I've based the rule on the example in https://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&post...
AZ_101139
Nimbostratus
May 26, 2009Hi,
I have a kind of similar problem. I am new to iRules so forgive me if this is some stupid mistake of mine.
Want to write a simple proxy which gets http request on port 7777, reads Host: header and forwards request according to it with its own source IP instead of the original client. The iRules are below (notice line 17 commented out below and dummy 18 inserted).
When I test it Host: header is found, NAME:lookup works for it, DNS is queried and then NAME_RESOLVED fires. However HTTP_REQUEST runs without any delay or waiting for NAME_RESOLVED thus I am unable to forward connection properly.
I can see this having the following outputs in the log:
May 27 01:36:17 tmm tmm[1785]: Rule az-proxy : AAA:cnn.com
May 27 01:36:17 tmm tmm[1785]: Rule az-proxy : YYY xxxx YYY in HTTP REQ
May 27 01:36:17 tmm tmm[1785]: Rule az-proxy : in name-resolved
May 27 01:36:17 tmm tmm[1785]: Rule az-proxy : XXX 157.166.224.25 XXX in NAME RESOLVED
But when I uncomment 17 as it should be while commenting out 18 I have following output:
May 27 01:35:29 tmm tmm[1785]: Rule az-proxy : AAA:cnn.com
May 27 01:35:29 tmm tmm[1785]: Rule az-proxy : YYY xxxx YYY in HTTP REQ
May 27 01:35:29 tmm tmm[1785]: 01220001:3: TCL error: az-proxy - bad IP address format while executing "node $real_server 80"
which clearly shows that initial value of "xxxx" got into 18 and NAME_RESOLVED was even not able to start.
How to make this wait for resolver to finish? I see no special 'wait'-like commands (also this would be at least suboptimal to insert something like this). Any suggestions highly appreciated
Many Regards
Andrzej
1 when RULE_INIT {
2 set ::debug 1
3 }
4
5 when HTTP_RESPONSE {
6 HTTP::header insert ViaP AZ
7 }
8
9 when HTTP_REQUEST {
10 set real_server "xxxx"
11 if {$::debug}{log local0. "AAA:[HTTP::host]"}
12
13 NAME::lookup [HTTP::host]
14 snat automap
15
16 if {$::debug}{log local0. "YYY $real_server YYY in HTTP REQ"}
17 node $real_server 80
18 node 10.10.10.10 80
19
20
21 }
22
23 when NAME_RESOLVED {
24 set real_server [lindex [split [NAME::response] " "] 0]
25 log local0. "in name-resolved"
26 if {$::debug}{log local0. "XXX $real_server XXX in NAME RESOLVED"}
27
28 }
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
