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
administratorrole. - 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
-
Go to Application → Application → Application properties and open
system.baseurl. In Application properties value, replacehttps://<yourinstancename>.servicely.aiwith your URL, such ashttps://<yourURL>. Save the record. -
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.
-
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=
- Identifier or login:
-
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.
-
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. -
Replace the script with the version below. Set
PROD_INSTANCE_BASE_URLto your Servicely URL andBASE_DESIRED_PROD_URLto 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.