0

I am trying to integrate cloud foundry adminui application. Url which I access is https://myexample.com/adminui/

It works as follows:

 Request 
     https://myexample.com/adminui/    

 Response
     http://uaa.devtest7.io/oauth/authorize?response_type=code&client_id=admin_ui_client&redirect_uri=https://admin.devtest7.io/login

The above is response is correct but sometimes I get response where redirect url is using internet host name.

http://uaa.devtest7.io/oauth/authorize?response_type=code&client_id=admin_ui_client&redirect_uri=https://myexample.com/login

I am modifying that in haproxy rule as follows. It works like a charm. But in one of the installation it is giving this problem.

backend bk_adminui
    mode http
    http-request set-header Host admin.devtest7.io
    reqrep ^([^\ ]*\ /)adminui[/]?(.*)     \1\2

Code ruby server app

def local_redirect_uri(request)
      "#{request.base_url}/login"
    end

App uses "#{request.base_url}/login to create redirect uri.sometime it works fine but other time it is not.I am modifying Host name in haproxy acl. Do I need to change any other field also? Do base_url and Host is same.

Any suggestions?

UPDATED

I was checking tcpdump of my server app i found this

Host: admin.devtest7.io
X-Forwarded-Host: myexample.com

Is this X-Forwarded-Host is translating in base_url ?

1 Answers1

0
http-request set-header X-Forwarded-Host %[req.hdr(Host)]

The above line worked for me.

LaurentG
  • 105
  • 2