Hello, how did you fix this issue?
Apr 1, 2023
2
Level 4
Vite config for HTTPS
I am trying to run vite with homestead over https, and have attempted to set the key and certificate in the vite config file. My vite config looks like this:
import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
import vue from '@vitejs/plugin-vue'
import defineOptions from 'unplugin-vue-define-options/vite'
import fs from 'fs'
const host = 'demo.local'
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
vue({
template: {
transformAssetsUrls: {
base: null,
includeAbsolute: false
}
}
}),
defineOptions(),
],
server: {
hmr: {
host: "192.168.10.10"
},
host: "192.168.10.10",
watch: {
usePolling: true,
},
https: {
key: fs.readFileSync(`/etc/ssl/certs/${host}.key`),
cert: fs.readFileSync(`/etc/ssl/certs/${host}.crt`),
}
}
However, when I run npm run dev, I receive the following error:
Error: EACCESS: permission denied, open '/etc/ssl/certs/demo.local.key'
I don't know what the issue with my permissions would be, I have ssh'd into homestead with the homestead user as normal. Do I need to edit my config to make this work?
Thanks!
Please or to participate in this conversation.