
Wir verlagern derzeit eine Anwendung, die Kontext verwendet, um „Profile“ auszuwählen (App-Eigenschaften und JDBC-Verbindungszeichenfolge definieren).
Im Moment sieht die URL so aus:https://www.foo.com/test/company/profil-name/ Dann werden Sie weitergeleitet zuhttps://www.foo.com/test/company/profil-name/web/online Aber es gibt auch andere Dinge wie API-Kontexte: https://www.foo.com/api/Profilname/
Ich weiß, dass die aktuelle Anwendung Apache + Haproxy im Frontend und Backend verwendet:
Web => apache => local haproxy => backend haproxy => application backend
Mein Problem ist, dass ich versuche, die gleiche Konfiguration hier zu reproduzieren, aber der Proxy funktioniert nicht richtig (ich teste mit einer geänderten Hostdatei):
https://www.foo.com/test/company/profil-name/Weiterleitungen zuhttps://www.foo.com/web/test/company/profil-name/online
Es ist, als ob der ursprüngliche Kontext von der Anwendung als Optionszeichenfolge übernommen wurde.
Ich habe einige Kombinationen in der Haproxy-/Apache-Konfiguration vorgenommen und wenn ich eine einfache Reverse-Proxy-Konfiguration ohne Profilkontextauswahl verwende, funktioniert es (außer, dass ich nur ein Profil habe …):
https://www.foo.com/web/online
Gab es dieses Verhalten bei Ihnen schon einmal? Ich verwende Haproxy 1.8 und Apache httpd 2.4.
So sieht meine Haproxy-Konfiguration aus:
frontend default
bind *:80
capture request header X-Forwarded-For len 15
acl rest_url path /api
acl rest_url path_beg /api/
acl app1_profile path_beg /test/company/app1
acl app2_profile path_beg /test/company/app2
use_backend app3 if rest_url
use_backend app1 if app1_profile
use_backend app2 if app2_profile
backend app1
cookie SERVERID insert indirect nocache httponly
#http-request redirect location http://test.domain.com%[url,regsub(^/web/,/test/company/app1/web/,)]%[query] if { path_beg /web/ }
#http-request set-var(txn.path) path
#http-response redirect location https://test.domain.com/test/company/app1/var(txn.path) if ! { path_beg /test/ }
#reqirep ^Host:\ .*$ Host:https://test.domain.com/test/company/app1/
server app1_backend 192.168.10.15:80
Apache-Konfiguration:
ProxyRequests On
ProxyPreserveHost On
<Location /test/company/app1/>
ProxyPass http://localhost:80/
ProxyPassReverse http://localhost:80/
</Location>
Ich habe Stunden damit verbracht, eine funktionierende Konfiguration zu erstellen, aber es funktioniert immer noch nicht. Ich hoffe, dass mir jemand helfen kann.
Danke,
Sebastian