Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Configure self-hosted app for HTTPS
## the cert dns doesn't really matter since it's self-signed.
$certName = "myappname.local"
$cert = New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -DnsName $certName
Write-Host "Created self signed cert: $($cert.Thumbprint) "
$guid = [guid]::NewGuid()
$ip = "0.0.0.0:443"
"http add sslcert ipport=$ip certhash=$($cert.Thumbprint) appid={$guid} " | netsh
#### netsh http delete sslcert ipport=$ip
## netsh http show urlacl
##This will give anyone permission to listen. Change user to the user or group running the service.
"http add urlacl url=https://*:443/ user=Users" | netsh
##Note: the url above must match EXACTLY what you listen on.
## e.g. this will work:
## WebApp.Start<Startup>("https://*:443/")
## these will not:
## WebApp.Start<Startup>("https://+:443/")
## WebApp.Start<Startup>("https://10.10.10.5:443/")
## so you may need to change the url above to match what your app listens on.
## (The variable $ip above does not need to be so specific.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.