🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
HardServerUrl
This page was created by Hans.karlsen on 2019-04-17. Last edited by Wikiadmin on 2026-07-29.

You can fix the public URL that MDrivenServer or Turnkey uses when it cannot correctly infer its own address from incoming requests; this is for deployments behind a load balancer or reverse proxy.

When to use HardServerUrl

MDriven Server and TurnkeyServer normally inspect incoming requests to determine their own address. This works when requests arrive directly at the application with the address that users and other components should use.

Set HardServerUrl when that detected address is wrong. A common example is a load balancer or reverse proxy that sends health-check requests using an internal address. If the application treats that internal address as its own URL, it can use the wrong URL for subsequent communication.

For example, users reach an application at https://app.example.com, but a reverse proxy contacts the application through an internal address. Configure HardServerUrl with the URL that the application must use for itself: https://app.example.com.

Configure the fixed URL

Create the configuration file in the App_Data directory of the application whose URL you need to fix.

  1. Stop the relevant MDrivenServer or Turnkey application.
  2. Open that application's App_Data directory.
  3. Create a file named HardServerUrl.xml.
  4. Add the required URL as the HardServerUrl attribute.
  5. Start the application and verify the startup log.
<root HardServerUrl="https://theaddressyouwantyourapplicationtohaveWhenWeTalkToTHISInstanceAndAvoidTheLoadBalancer"></root>

Use the complete URL that the application should regard as its own address. Do not use the load balancer's internal health-check address when that is not the address the application must use.

Configure Turnkey separately when required

HardServerUrl controls the application’s own detected URL. It does not replace the setting that tells Turnkey where to find MDrivenServer.

When your system includes Turnkey, confirm that Turnkey is configured with the correct MDrivenServer URL in App_Data/MDrivenServerOverride.xml. Configure that connection as described in Documentation:MDrivenServerOverride.

For example, the two settings have different purposes:

Setting Purpose Location
HardServerUrl.xml Fixes the URL that MDrivenServer or Turnkey uses as its own address. App_Data of the affected application
MDrivenServerOverride.xml Tells Turnkey which MDrivenServer URL to use. App_Data of the TurnkeyServer

SignalR consideration

Setting HardServerUrl for a Turnkey application also affects its SignalR connection. In some reverse-proxy deployments, the application may need to find itself using a local server address rather than the reverse-proxy address used to call it.

Test the SignalR connection after applying the setting. If Turnkey must use a particular MDrivenServer address, review Documentation:MDrivenServerOverride, including its SignalR-related configuration guidance.

Verify the setting at startup

HardServerUrl is available in builds from 2019-04-17. In MDrivenServer and Turnkey versions after 2022-04-28, inspect the startup log to confirm whether the file was applied.

If the file is not present, the log reports that the application URL remains unchanged:

2022-04-28 11:41:30,773 [9] INFO - <path>\App_Data\HardServerUrl.xml NOT found - App url is unchanged: https://localhost:44368

If the file is present and applied, the log reports:

2022-04-28 11:41:30,773 [9] INFO - <path>\App_Data\HardServerUrl.xml found and applied:  https://localhost:44368

The logged URL lets you confirm that the running application found HardServerUrl.xml and applied the intended address.

See also