Docs Menu

Configure Charts Web Server to Use HTTPS

On this page

  • Prerequisites
  • Procedure

You can configure the MongoDB Charts web server to use the HTTPS protocol, as opposed to the default HTTP protocol. With the HTTPS protocol, the web server encrypts your data using SSL, which ensures that the host transmits data securely.

This process differs from configuring SSL for data sources, because this process enables TLS/SSL on the Charts web server itself, rather than configuring a connection to a specific MongoDB deployment with TLS/SSL enabled. When HTTPS is configured, Charts uses the standard HTTPS port 443 by default, and the Charts web server redirects any requests over HTTP (port 80) to the equivalent HTTPS port.

Before you can configure HTTPS for your MongoDB Charts web server, you must first obtain an SSL key and certificate from an appropriate certification authority. Instructions for obtaining an SSL key and providing a list of trusted certificate authorities are out of scope for this tutorial.

To configure the MongoDB Charts web server to use the HTTPS protocol:


Uncomment the following variables in the services.charts.environment section of the Compose file you downloaded as part of the Charts installation procedure:


Replace the values of these variables with the names of your certificate file and key file respectively. The certificate must be in the .pem format and the key file must be a .key file.


The values of these variables must be filenames, not complete file paths. These files are always loaded from the web-certs volume.


If MongoDB Charts is already running, remove the Charts Docker stack using the following command:

docker stack rm mongodb-charts

Before redeploying, you need to ensure that the Charts containers are fully shut down. You can confirm this by running the docker ps command several times, until it shows no running Charts containers.

Once all Charts containers have shut down, relaunch the stack using the following command:

docker stack deploy -c charts-docker-swarm-19.12.2.yml mongodb-charts

If you are using a different version of Charts, replace 19.12.2 with the version number of your release.


First, run the following command to obtain the Docker service ID for MongoDB Charts:

docker service ls

Retrieve the service logs by running the following command using the service ID from the previous step:

docker service logs <service ID>

If there are no errors reported in the logs, MongoDB Charts should now be configured to use HTTPS and will now automatically redirect from the HTTP address to the HTTPS address in a web browser. If the logs return any errors, see the Troubleshooting section for possible solutions to the issues listed.

Give Feedback
© 2021 MongoDB, Inc.


  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.