[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Publish Openshift with F5 irules



Hello,

I want to publish Openshift with F5, I created a irule but still does not work, this is my problem:


Internal URL - openshift.example.corp
External URL - openshift.example.es

I've created a F5 virtual server with an irule configured to permit connect to openshift with the External URL. This is the irule:

-- 
when RULE_INIT {
 
   # Log debug messages to /var/log/ltm? 1=yes, 0=no
   set static::rewrite_debug 1
 
   # Externall hostname for the web application
   set static::Externall "openshift.example.es"
 
   # Internall hostname for the web application
   set static::Internall "openshift.example.corp"
}
when HTTP_REQUEST {
 
   if {$static::rewrite_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: New HTTP request to [HTTP::host][HTTP::uri]"}
 
   # Prevent the server from sending compressed responses as LTM does not decompress them
   HTTP::header remove "Accept-Encoding"
   if {$static::rewrite_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: Removing Accept-Encoding request header"}
 
   # Replace host header with the Internall name
   HTTP::header replace Host $static::Internall

   # Disable the stream filter for non-text responses
   STREAM::disable
}
when HTTP_RESPONSE {
   # Rewrite Location header value in HTTP redirects if it contains the $static::Internall string
   if {[HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains $static::Internall}{
 
      # Replace $static::Internall with $static::Externall in Location header value
      log local0. "location 1 = [HTTP::header "Location"]"
      HTTP::header replace Location [string map "$static::Internall $static::Externall" [HTTP::header Location]]
      log local0. "location 2 = [HTTP::header "Location"]"

      if {$static::rewrite_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: Updated location from [HTTP::header Location]\
         to [string map "$static::Internall $static::Externall" [HTTP::header Location]]"}
   }

   # Rewrite the response body if the response type is text
   if { [HTTP::header "Content-Type"] starts_with "text/" } {
 
      # Configure the find/replace strings
      STREAM::_expression_ "@$static::Internall $static::Externall@"
 
      # Enable the stream filter
      STREAM::enable
 
      if {$static::rewrite_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: Enabled stream filter for $static::Internall -> $static::Externall"}
   }
}
--

When I try to connect with the external URL, Openshift automatically redirect to /console and it seems to load the login but finally redirect to internal URL /login.


The browser steps:

External URL -> External URL /console -> Internal URL /Oauth -> Internal URL /login


anyone have any idea?

Regards,
Fran.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]