ottleydamian
Mar 13, 2019Cirrus
Rewrite URI & protocol and send to a node
Scenario:
- An https request comes in 2. Modify the URI 3. Modify the protocol to http 4. Do a DNS lookup for the node 5. Forward the request to the node
Number 3 & 5 is what I'm having issues with. Every thing else works but it doesn't send anything to the node and I don't know a command to call to change the protocol (like URI::protocol, which seems to only read the protocol but I don't think it can be used to change the protocol).
Using logs messages I verified that the URI was changed as needed and the node has the right IP address from DNS but will changing the URI send the request on (forward)? And how do I change the protocol?
Below is an example of what I am thinking:
when HTTP_REQUEST {
set myURI [string range [HTTP::uri] 1 end]
scan $myURI {%[^/]/%s} var1 var2
set myDNS $var1.domain.biz
HTTP::uri $var1.domain.biz/$var2
set myNode [RESOLV::lookup @$static::@8.8.8.8 -a $myDNS]
if {$myNode ne ""}{
node [lindex $myNode 0]
}