A collection of 4 posts

Modifying host headers with Azure websites when using it behind an Application Gateway or reverse proxy via URL Rewrite Module

I'm currently using Azure's Application Gateway with a backend pool utilising Azure's App Service. When the application gateway forwards your request to the backpool, it also forwards X-Original-Host HTTP Header together with it to help you identity which listener the gateway originally acted upon but what if you wanted it to match the HOST header at the web server (app service)? This might be useful for cases where you need to generate absolute URLs in your web app for whatever ...

Creating a self signed certificate for web development on IIS using powershell

We will need to run the following on Powershell with Administrator rights. # Setup variables $companyName = "contoso" $certFilePath = "$PSScriptRoot\$companyName-wildcard.pfx" $dnsName = "*.$companyName.com" $date = (Get-Date).ToString('MMM-yyyy') $certFriendlyname = "$companyName-wildcard-$date" $certExpiry = (Get-Date).AddYears(10) # Removal existing certificates gci Cert:\LocalMachine\Root | Where FriendlyName -Like "*$companyName*" | Remove-Item gci Cert:\LocalMachine\My | Where FriendlyName -Like "*$companyName*" | Remove-Item # Create self signed certificate and store thumbprint variable $thumb = (New-SelfSignedCertificate -DnsName $dnsName -CertStoreLocation ...

Finding and tailing IIS HTTP logs

Find where the logs are located for each website Import-Module WebAdministration foreach($WebSite in $(get-website)) { $logFile="$($Website.logFile.directory)\w3scv$($website.id)".replace("%SystemDrive%",$env:SystemDrive) Write-host "$($WebSite.name) [$logfile]" } # Results mysite1.dev[C:\inetpub\logs\LogFiles\w3scv2] mysite2.dev[C:\inetpub\logs\LogFiles\w3scv3] mysite3.dev[C:\inetpub\logs\LogFiles\w3scv4] mysite4.dev[C:\inetpub\logs\LogFiles\w3scv5] mysite5.dev[C:\inetpub\logs\LogFiles\w3scv1] mysite6.dev[C:\inetpub\logs\LogFiles\w3scv6] # Let's ...

Diagnosing 500 Internal Server Errors from IIS

Windows 10 Setup In short, setup failed request tracing feature on IIS On Windows 10, let's first enable it netmgr > server > website > failed request tracing rules > edit site tracing > enable add > all content > status codes > 500 Then to view the logs inetmgr > server > website > failed request tracing rules > view trace logs then find the fr*.xml related files, right click and open with IE Internet Explorer. Not sure ...