IIS URL Rewrite variable to display the hosts machine name in the response header.
See "server-name" header below:
Perform the following actions on the IIS server
- Download IIS-URL-Rewrite-ServerNameProvider DLL to C:\Temp
- Copy NETFX-4.8-Tools to C:\Temp
- Run the following PowerShell command to register assembly to the Global Assembly Cache (GAC):
& 'C:\Temp\NETFX-4.8-Tools\gacutil.exe' -i "C:\Temp\IIS-URL-Rewrite-ServerNameProvider.dll"
- (Optional) Run the following PowerShell command to view the contents of the GAC:
& 'C:\Temp\NETFX-4.8-Tools\gacutil.exe' -l
- Open IIS -> URL Rewrite (either at server level or site level)
- Select "View Providers..."
- Select "Add Provider..."
- Select the provider from the dropdown and then copy over the name that is listed to the name field
- Go back to URL Rewrite and select "Add Rule(s)..."
- Select a "Blank rule"
- Edit the Outbound Rule as shown below
- Restart the IIS server
Note: In order to build the DLL you will need the Key.snk file which can be found here
- Clone the repository to your local disk
- Add the Key.snk file to the repository
- Open solution in Visual Studio 2017 or greater
- Simply select Build>Build Solution from the top menu