HAProxy community

Nginx location alternative in haproxy

Is this also possible in haproxy?

location /.well-known/matrix/server {
  return 200 '{"m.server": "chat.domain.com:443"}';
  add_header Content-Type application/json;

Yes, in 2.2 you can use http-request return:


In older releases you need a fake backend, with a custom 503 errorfile.


for the impatient:
http-request return status 200 content-type 'application/json; charset=utf-8' string '{"m.server": "xx.xxx.xx:443"}' if { path /.well-known/matrix/server }

(on one line!!!)