Last active
September 22, 2017 19:54
-
-
Save ctigeek/5eec9ff367cfb3e31ecbf57266cb40e1 to your computer and use it in GitHub Desktop.
Configure self-hosted app for HTTPS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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