Server Installation on a different port

Hello everbody

I need to publish the Mender server using the port 44344 because there is a traefik for my already existing services on the port 443. I thought that I can make use of traefik behind traefik as shown below:

The steps that I have already followed so far are the following:

  1. I have changed mender-api-gateway service in prod.yml file inside the directory production/config such that it is now as follows:

    ports:
    “44344:443”
    network:
    mender
    traefik-public


    environment:
    ALLOWED_HOSTS: my-domain.com:44344

Note: treafik-public is the network of the services that are routed by my already existing traefik on port 443.

  1. I have changed the mender-api-gateway service inside docker-compose.yml file, and it is now as follows:



networks:

  • mender
  • traefik-public


    labels:
    - “traefik.enable=true”
    - “traefik.http.routers.mender-api-gateway.rule=Host(my-domain.com)”
    - “traefik.http.services.mender-api.gateway.loadbalancer.server.port=443”
    - “traefik.http.routers.mender-api-gateway.entrypoints=websecure”
    - “treafik.http.routers.mender-api-gateway.tls=true”
    - “traefik.http.routers.mender-api.gateway.tls.certresolver=leresolver”
    - “treafik.docker.network=traefik-public”




    networks:
    mender:
    traefik-public:
    external: true

The things that I have done so far is not sufficient to make the server work. The other things that I have tried with this configuration is that I have both written the port 44344 at the end of the allowed host domain, and not written it. Both cases did not work.

When I go to the the my-domain.com, it says the page is not working.When I go to the my-domain.com:44344 , it says connection is not secure, and I cannot go further from there.

Has anyone accomplished that?
Thanks in advance.

Hi @dekan :wave:

When I go to the the my-domain.com, it says the page is not working.When I go to the my-domain.com:44344 , it says connection is not secure, and I cannot go further from there.

It looks like either the certificate for the Mender Traefik instance is not covering my-domain.com or you’re using a self-signed certificate. You need to provide a trusted certificate to the mender traefik instance as well (check the volume mounts for /etc/traefik/certs/cert.crt in the mender-api-gateway service). If the entire mender deployment (including the gateway) inside a secure private network, would it be an alternative to disable TLS?

For the public gateway, if you’re setting up a route based on a path prefix, you need to create a middleware that strips this path prefix when it’s forwarded to the Mender Traefik instance.

Thank you.
I checked the volume mounts, it looks correct.But, now I am getting Bad Gateway when I go to the domain.com. What could be the reason when you consider my case ?