Docs
On this page
task2 min readApplication: Platform

Serve Servicely behind a reverse proxy

Point the base URL, single sign-on and the start-up script at your own domain after you put a reverse proxy in front of Servicely.

A reverse proxy on your own web servers serves your Servicely instance from your own domain, such as https://<yourdomain>.com. This page is for administrators who have set up the proxy and now need Servicely to use the new URL.

A reverse proxy is not a redirect. With a redirect, the browser shows the Servicely URL once the page loads. With a reverse proxy, it keeps showing your URL.

Before you begin

  • You need the administrator role.
  • Set up and test the reverse proxy first, for example with Apache HTTP Server or NGINX. Follow that product’s documentation. You can use a domain or a subdomain, as long as you use the full URL everywhere below.
  • Your organisation runs and supports the proxy. If the proxy is down, users cannot reach Servicely through your URL.
  • Tell Servicely that you are making this change.
  • On a live instance, make the change outside business hours. It changes the base URL and the single sign-on set-up.

Steps

  1. Go to Application → Application → Application properties and open system.baseurl. In Application properties value, replace https://<yourinstancename>.servicely.ai with your URL, such as https://<yourURL>. Save the record.

  2. If single sign-on is already set up, open the identity provider under Administration → Authentication → Identity provider. Clear Login URL, IDP Metadata XML and SP Metadata XML, then save.

  3. In your identity provider, replace the Servicely URL with yours in the three URLs below. Keep the rest of each URL as it was.

    • Identifier or login: https://<yourURL>/idp_callback?client_name=
    • Reply: https://<yourURL>/idp_callback?client_name=
    • Logout: https://<yourURL>/idp_callback?logoutendpoint=true&client_name=
  4. Download the metadata from your identity provider. Paste its content into IDP Metadata XML on the Servicely identity provider record, save, and test single sign-on.

  5. Go to Administration → Business Logic → System configuration scripts and open “Set initial BaseURL System Property”.

    The System configuration scripts list with the Set initial BaseURL System Property script.
  6. Replace the script with the version below. Set PROD_INSTANCE_BASE_URL to your Servicely URL and BASE_DESIRED_PROD_URL to your proxy URL, then save.

    // See if the property already exists
    let propertyRecord = ApplicationPropertyManager.getGlobalPropertyRecordByKey("system.baseurl");
    let generatedBaseURL = ApplicationPropertyManager.generateDefaultBaseUrl();
    
    let PROD_INSTANCE_BASE_URL = "https://<yourinstancename>.servicely.ai"; // Replace with your Servicely URL
    let BASE_DESIRED_PROD_URL = "https://<yourURL>"; // Replace with your reverse proxy URL
    
    if (propertyRecord == null) {
        // It doesn't exist, so create the property
        ApplicationPropertyManager.createGlobalPropertyRecord(
            SYSTEM_BASEURL_PROPERTY,
            generatedBaseURL,
            "string",
            "The base URL to use for URL construction (e.g. creating external links)"
        );
    } else {
        // The record already exists, so update it to a new value if appropriate
        let currentValue = propertyRecord.Value();
    
        if (generatedBaseURL == PROD_INSTANCE_BASE_URL) {
            // On production, keep the reverse proxy URL
            if (currentValue != BASE_DESIRED_PROD_URL) {
                propertyRecord
                    .Value(BASE_DESIRED_PROD_URL)
                    .update();
            }
        } else {
            if (currentValue != generatedBaseURL) {
                propertyRecord
                    .Value(ApplicationPropertyManager.generateDefaultBaseUrl())
                    .update();
            }
        }
    }
    

The shipped script runs at every node start-up. It resets system.baseurl to the instance’s own Servicely URL, so without the change in the last step your URL is lost at the next restart. The edited script keeps your URL on production and still resets the URL on any other instance, such as a clone.

If you set up single sign-on after the proxy, use your own URL in the identity provider from the start.

Result

Servicely builds external links from your URL, and single sign-on returns users to your URL. The base URL survives restarts on production. On a non-production instance cloned from production, the script sets the base URL back to that instance’s own address.

Last updated 18 October 2026commit 50111ae9bd3bChris Jones
Back to top