I just realized that this isn't actually correct: in their web browser it gets proxied to a backend running at https://<application>.cloud.example.com/main?query
I need this request: https://cloud.example.com/<application>[/<remainder of path>]?query to be sent to the backend server directly as http://<application>.cloud.example.com/<remainderr of path>?query I assume I can use http-request set-uri to rewrite the incoming URL. I assume I can grab the host name thus: http-request set-var(req.header_host) req.hdr(host) But how do I grab the path? And separate the remainder of the path if necessary, so I can reassemble the URL as described above? -----Original Message----- From: Norman Branitsky Sent: Monday, August 27, 2018 6:53 PM To: 'Tim Düsterhus' <[email protected]>; haproxy <[email protected]> Subject: RE: URL rewrite Your examples are all correct. -----Original Message----- From: Tim Düsterhus <[email protected]> Sent: Monday, August 27, 2018 6:22 PM To: Norman Branitsky <[email protected]>; haproxy <[email protected]> Subject: Re: URL rewrite Norman, Am 27.08.2018 um 23:45 schrieb Norman Branitsky: > I need to rewrite my URLs according to the following pattern: > cloud.example.com/<application>?query > becomes: > <application>.cloud.example.com/main?query > > HAProxy will terminate SSL - I have a wildcard certificate for > *.cloud.example.com. > As the target servers are running Docker Enterprise, I do not need DNS > entries for every possible instance of <application> as Docker EE will handle > this internally. > Is there a way to do this? > What exactly do you mean by rewrite? Do you want that when a user requests https://cloud.example.com/<application>?query in their web browser it gets proxied to a backend running at https://<application>.cloud.example.com/main?query ? Is it possible that there follows a path that you need to preserve: https://cloud.example.com/<application>/<path>/<file>?query to https://<application>.cloud.example.com/main/<path>/<file>?query ? Best regards Tim Düsterhus

