Forum Discussion

Vishal_96707's avatar
Vishal_96707
Icon for Nimbostratus rankNimbostratus
May 26, 2009

Redirection help

I need help with redirection.

 

Here is the config,

 

- The app VS is running on 443

 

- There is one more VS configured listening on port 80 which is just forwarding requests to HTTPS VS

 

- The app is running Jboss app server

 

- The app url is https:///abc/xyz/login.do. Even if you just type https:///abc/xyz, the app takes you to https:///abc/xyz/login.do

 

- The requirement is if someone types https:// then it should go to https:///abc/xyz or https:///abc/xyz/login.do

 

- As per the app guys the redirection from root to the specific uri is not possible using the app server

 

- I tried simple redirection using HTTP::redirect -> end page, but that is causing redirect loop

 

 

Can someone please assist?

4 Replies

  • Can you use a browser plugin like HttpFox for Firefox or Fiddler for IE to see what's actually happening? Can you try testing a rule like this:

     
     when HTTP_REQUEST { 
      
        log local0. "[IP::client_addr]:[TCP::local_port]: New [HTTP::method] to [HTTP::host][HTTP::uri]" 
      
        if {[HTTP::path] eq "/"}{ 
      
           log local0. "[IP::client_addr]:[TCP::local_port]: Redirecting to https://[HTTP::host]/abc/xyz/login.do" 
           HTTP::redirect "https://[HTTP::host]/abc/xyz/login.do" 
        } 
     } 
     

    It might also be an issue where the app is redirecting to http://, gets redirected from the HTTP VIP to HTTPS, and then gets redirected again to HTTP by the app. If this is happening, you might try creating a custom HTTP profile with rewrite redirects enabled and adding it to your HTTPS VIP.

    Aaron
  • Thanks Aaron for providing quick solution as usual. I will try this and let you know. Thanks again.
  • Thanks Aaron the solution worked. Here is one more issue surfaced.

     

    The pool has got one server running on 443 and other on 9443. The VS is configured to listen on port 443. Everything works fine the request is going to 443 port pool member. It breaks with 9443 pool member. I have analyzed the issue and here is what happening, after I enter username/password, the app sends hardcoded response url with https://:9443/. As the VS is configured to listen on 443 it breaks.

     

    1) Can i configure VS to listen on 2 ports? I tried something [TCP::local_port clientside eq "443"] & [TCP::local_port clientside eq "443"] but it didnt work successfully.

     

    2) I think this can be done with url rewrite too. I am not expert with iRules and url rewrite. Can someone please assist? I just want to trap the url's with :9443 and rewrite them to use 443.

     

    If you think of any other solution then please let me know.
  • Does the application include the :9443 port reference in 30x redirects in the Location header value? Or in response content? For the Location header, you can use an iRule like this:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/RewriteHTTPRedirectPort.html

     

     

    For response content you can use a stream profile and STREAM::expression based iRule (Click here).

     

     

    Aaron