I don't know what I did wrong previously, but I re-attempted it and managed to get it to work with the same thought processing in mind. I created a backend that will be my local web server:
- Open HAProxy/Backend and add a new backend entry, named , which forwards to port
My http/https offloader (front-end) defines a path rule and redirects to such backend if we have an ACME challenge:
- Edit your frontend, which shall be named and is triggered by any external address with port
- Under "Access Control List" add an entry called with the expression "Path starts with:", CS: no (not case-sensitive), Not: no (no inversion) and the value
- You now need two actions, one for the condition name and one for . should offload using the action "http-request redirect" with the rule while should use the action "Use Backend" with the previously created local backend
Maybe it was the ordering of the actions, maybe it was the naming. I was pretty confident that I tested my previous setup with 127.0.0.1 as well, but this seems to work and I don't know why it did not work previously.
Now it was very easy to confirm the configuration is right when using postman. Say you have the domain example.org, you should do a GET request to two different URLs to validate their response:
http://example.org/foobar: Should return a Location header with the https version of the URL, so confirming the offloader works
http://example.org/.well-known/acme-challenge/foobar:
Should timeout! It must not return an error immediately, or the configuration is wrong. If the configuration is right, it will try to talk to the standalone HTTP server that only runs during the ACME challenge, so it will timeout with 503 Service Unavailable after 60 seconds or so, which means it will succeed if the standalone HTTP server is running.
With this setup the "Standalone HTTP server" method will work.