Closed devcoder18 closed 7 years ago
@devcoder18 This can be done using haproxy url rewrite describing here: https://www.haproxy.com/doc/aloha/7.0/haproxy/http_rewriting.html#set-the-url-path
And you can add the instruction using, for example, EXTRA_FRONTEND_SETTINGS_80
environment variable describing in the README.
Thanks. I used EXTRA_SETTINGS
because I need the rewrite in the backend. This seems to work:
sudo docker service create -e SERVICE_PORTS="80" --name helloworld \
-e VIRTUAL_HOST="*/helloworld, */helloworld/*" \
-e EXTRA_SETTINGS="reqrep ^([^\ ]*\ /)helloworld[/]?(.*) \1\2" \
--network proxy dockercloud/hello-world
Closing this issue. Would recommend documenting this method in README.md examples section as it is a common use-case for web/rest services
I am running dockercloud/hello-world in docker swarm.
I want to redirect requests for http://myhost.domain/helloworld to the root url of the helloworld service. How can I do this? I tried the following but incoming requests are hitting the helloworld nginx container on
/helloworld
instead of the root url/
Logs from helloworld/nginx container:
10.0.0.3 - - [03/Apr/2017:23:24:47 +0000] "GET /helloworld HTTP/1.1" 200 485 "-" "Mozilla/5.0
Helloworld service:
haproxy service: