Forum Discussion

Pawel_G_306732's avatar
Pawel_G_306732
Icon for Altostratus rankAltostratus
Jan 18, 2017
Solved

Redirect iRule for http TimeStamp service

Hi fellows, I have spent couple of days struggling to redirect Time-Stamp service to different port. Basically it's a normal http connection based service.

I Wrote an iRule:

when HTTP_REQUEST 
{
if {([HTTP::path] contains "tsa") and ([HTTP::host] contains "8080") }{
HTTP::redirect "http://10.132.24.96:8040[HTTP::uri]"
}
}

It works in a browser but not as a TimeStamp service...

Funny thing is that when I'm accesing it with addres http://10.132.24.96:8040[HTTP::uri] it works fine, but not when I use http://10.132.24.96:8080[HTTP::uri] - the redirected one is not working and I've no idea why...

I Hope I can count on Your advise on this topic. Up-front thanks to anyone who can help.

  • Ok, so I've changed redirect to HTTP::respond 307 Location as redirect can't pass POST.

     

    Everything works fine now :)

     

    Thanks for advice on -L switch in curl @Jad.

     

6 Replies

  • Your iRule looks good. Maybe you can make it a bit more specific by matching on ":8080" instead of just "8080".

     

    1.Check to see if there are any errors in the logs.

     

    2.Can you run a curl command to see what kind of redirect or response you are getting ? This will help identify the issue.

     

  • Based on the CURL output (Location Header), the redirect seems to be working.

     

  • Hi,

    if you want to check port, you can use this irule :

    when HTTP_REQUEST {
        if {([HTTP::path] contains "tsa") and ([TCP::local_port] equals "8080") }{
            HTTP::redirect "http://10.132.24.96:8040[HTTP::uri]"
        }
    }
    
  • Ok, so I've changed redirect to HTTP::respond 307 Location as redirect can't pass POST.

     

    Everything works fine now :)

     

    Thanks for advice on -L switch in curl @Jad.