Serving responses for matrix server


I've been migrating from nginx to traefik the past few days and man has it been a learning curve.

There's one last step before everything is fully operational. I need to serve static responses from specific URL's. Example:

$ curl

Matrix homepage
$ curl

{ "m.server": "" }


This is the code I used in nginx:

location /.well-known/matrix/server {
  default_type application/json;
  add_header Access-Control-Allow-Origin *;
  return 200 '{"m.server": ""}';

As well as this:

location ~* ^(\/_matrix|\/_synapse\/client) {
  proxy_set_header X-Forwarded-For $remote_addr;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header Host $host;

  # Nginx by default only allows file uploads up to 1M in size
  # Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
  client_max_body_size 50M;

How can I do this in traefik's static configuration?

UPDATE: Turns out traefik can't do this, I have to add another nginx container onto the matrix stack in order to serve these replies. Closing this since it's basically solved.

It is crashing by time again and again.

Hey @Dapist

Traefik can automatically obtain the appropriate TLS certificates by configuring CertResolvers.
Please dive deep into these docs Let's Encrypt - Traefik to see how it should be configured.
That means there is no need to configure explicitly location for the HTTP challenge.

Regarding the size of data that can be forwarded to the services, there are a few configuration options that might be configured, please see the section Buffering Buffering - Traefik.

Thank you,