A Singapore Government Agency Website

NGINX routing

Overview

As your web application will be running behind the Console domain, the base path will be the Console URL combined with your product ID. You will need to configure NGINX to route the request to your domain.

For example: https://console.developer.tech.gov.sg/sample-app → https://<your-domain>/

Within NGINX, requests will be proxied accordingly to your actual path (for example, https://<your-domain>/sample-app/*).

NGINX config

The NGINX configuration repository is located at: Console NGINX config repo

Under the respective environment folder, update the NGINX config to route requests to your web application. There are two subfolders used for this purpose:

  • upstream: define your server upstreams
  • location: define path locations and which upstream to proxy to

You may refer to existing product configs in the repository as examples.

Folder locations

Sample upstream and location config

# upstream/<product_id>.conf
upstream your-product {
    server your-product.gov.sg;
}

upstream your-product-api {
    server api.your-product.gov.sg;
}

# location/<product_id>.conf
location /<product_id>/ {
    proxy_pass https://your-product;
}

location /<product_id>/api/ {
    proxy_pass https://your-product-api;
}

Deploying NGINX

Once your changes are ready, submit a merge request to the Console team. After it is merged, a pipeline will run to deploy the new NGINX configuration. Once the final job completes, allow a few minutes for the new NGINX pod to be deployed with the updated config.

NGINX healthchecks

You are strongly encouraged to add healthchecks for your application. The healthchecks folder can be used for this purpose. If a healthcheck fails, the Console team will be notified through Slack and can investigate accordingly. You may also contact the Console team to be added to the relevant Slack channels.

Folder locations

Chat with me!
Bot Launcher