Skip to content
Mint Service Desk Documentation centre

Reverse Proxy

Mint Service Desk 3.4.2 user manual.

Configuration of redirections

Configure routing in the server block of nginx.conf. The built-in reverse proxy has 4 location blocks:

location /api/ {
  proxy_pass http://gateway/api/;
  include common_location.conf;
}

location /livereloadHub {
  proxy_pass http://gateway/livereloadHub;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
}

location ~* ^/(idp|connect|\.well-known|Account|external) {
  proxy_pass http://auth;
  include common_location.conf;
}

location / {
  proxy_pass http://frontend;
  include common_location.conf;
}

The first block routes requests under https://domain.name/api/ to Gateway.

The second block routes https://domain.name/livereloadHub to Gateway and enables WebSocket communication.

The third block routes requests to Auth, including the login page, OpenID Connect and static resources used by the login page.

The last block routes all other requests to Frontend.

The common_location.conf file defines proxy headers, including X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host and X-Forwarded-Port.

SSL Configuration

Configure SSL in ssl.conf: supported protocols, encryption options and certificate paths. The default certificate directory is /etc/ssl/private/:

ssl_certificate             /etc/ssl/private/fullchain.pem;
ssl_certificate_key         /etc/ssl/private/privkey.key;

Changes in services.yml

Update the service definitions in services.yml before running the reverse proxy on the host.

  1. Expose the ports of the Frontend, Gateway and Auth services directly. For example:
gateway:
   image: mint/gateway:latest
   ...
   ports:
     - port_on_which_we_want_to_start_service:80
  1. Remove the Reverse Proxy service definition from services.yml.

Note: Use the ports defined here when configuring the reverse proxy. After starting the stack, these services are directly accessible on the host.

Configuring the reverse proxy

This example uses nginx as the HTTP reverse proxy on the host. Start with the configuration used by the built-in Reverse Proxy service.

Docker Swarm uses an overlay network. Services on that network are not accessible at localhost. Use ip addr to find the address used to access the stack.

Example output:

...
5: docker_gwbridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:98:4e:fe:bc brd ff:ff:ff:ff:ff:ff
    inet 172.21.0.1/16 brd 172.21.255.255 scope global docker_gwbridge
       valid_lft forever preferred_lft forever
    inet6 fe80::42:98ff:fe4e:febc/64 scope link
       valid_lft forever preferred_lft forever
...

Use the address assigned to docker_gwbridge when configuring the reverse proxy. The address given in this example is 127.21.0.1.

In nginx.conf, replace the built-in Reverse Proxy destination addresses. For example, replace http://gateway with http://ip_address_docker_gwbridge:the_port_where_the_service_was_exposed. Update the other location blocks in the same way.