Forum Discussion

Dudi1's avatar
Dudi1
Icon for Nimbostratus rankNimbostratus
Jul 07, 2019

Problem With Publish inside App so i will be reach it from Outside

Hi all

We have in our organization F5 LTM

i have inside app that have the server ip address 10.7.4.94

But the app speak with the server in the FQDN name of "app-server.ashdod.eu"

now the app-server.ashdod.eu is inside address

but the address that i try to reach to from the world is "FrontEnd.ashdod.muni.com"

now my problem is that when i reach to "FrontEnd.ashdod.muni.com"

i get from the app

"Error loading https://app-server.ashdod.eu/portal/sharing/rest/portals/self?f=json&callback=dojo_request_script_callbacks.dojo_request_script0"

So from what i see the app return instead of FrontEnd.ashdod.muni.com its return app-server.ashdod.eu that is inside address

any suggestion ?

1 Reply

  • Dudi,

    Your server is likely sending app-server.ashdod.eu in a location header on response so the browser then requests 'app-server.ashdod.eu/path/'.

    You will need to rewrite the host on both client and server side requests/responses.

    Client request: FrontEnd.ashdod.muni.com > (F5) change FrontEnd.ashdod.muni.com to app-server.ashdod.eu > Send to server

    Server response: app-server.ashdod.eu > (F5) change app-server.ashdod.eu to FrontEnd.ashdod.muni.com > send to response to client.

    Refer to https://devcentral.f5.com/s/feed/0D51T00006i7Vu6SAE, @frisco76 104868 for credit.

    when RULE_INIT {        
     set ::external_hostname "FrontEnd.ashdod.muni.com"         
     set ::internal_hostname "app-server.ashdod.eu"    
      Enable debug logging to /var/log/ltm.  1 = yes, 0 = no 
     set ::hostname_rewrite_debug 0 
     }    
      
      
     when HTTP_REQUEST {                
     if {$::hostname_rewrite_debug}{log local0. "Original URL: [HTTP::host][HTTP::uri]"} 
      
     HTTP::header replace "Host" $::internal_hostname        
      
     if {$::hostname_rewrite_debug}{log local0. "New URL: [HTTP::host][HTTP::uri]"} 
     }    
      
      
     when HTTP_RESPONSE {         
     if { [HTTP::header value "Location"] starts_with "$::internal_hostname" }{ 
      
     if {$::hostname_rewrite_debug}{log local0. "Inside of HTTP::header location, orig HTTP location equals: [HTTP::header location]"} 
      
     set ::location [HTTP::header location] 
      
     HTTP::header replace location $::external_hostname 
      
     if {$::hostname_rewrite_debug}{log local0. "Inside of HTTP::header location, new HTTP location equals: [HTTP::header location]"} 
     } 
     }