Reputation: 7829
I have created a standard Vue application in Visual Studio 2019, using the default Vue project template. I am using Windows 10. This creates a simple project you can start up with the Vue CLI. This site runs in HTTP only, causing issues with other projects I'm debugging that only accept HTTPS.
My question: how do I force my Vue site to run in HTTPS?
Upvotes: 2
Views: 823
Reputation: 1
I've faced a similar issue and have identified a solution tailored for individual projects.
Inside your vue project, you could set your project with vue.config.js
devServer: {
https: true,
proxy: {}
}
Then, you can npm run dev again and run the project in HTTPS.
Upvotes: 0
Reputation: 7829
Inside Visual Studio, right click the project containing the Vue app and select properties. Add "--https" to "Script Arguments", behind "serve". Make sure to put a space between "serve" and "--https".
There's a good chance your connection will not be secure as the SSL certificate is not recognized. You can use mkcert to create a valid HTTPS certificate. To use that, type the following commands:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install mkcert
mkcert -install
mkcert localhost
Restart your computer, start your solution, done.
Upvotes: 3