Skip to content

Using SSL on a Local Computer (Windows 11) #4751

Answered by Sa1ch
Sa1ch asked this question in Help
Discussion options

You must be logged in to vote

Figured it out! :)

In the server.ts file, you need to add the following:

import fs from 'fs'
import https from 'https'

...

const httpsOptions = {
  key: fs.readFileSync('path/to/ssl/example.com-key.pem'), 
  cert: fs.readFileSync('path/to/ssl/example.com-crt.pem'),
  ca: fs.readFileSync('path/to/ssl/example.com-chain.pem'),
}

And replace

.start()

with:

.start(
    (handler) => {
      return https.createServer(httpsOptions, handler)
    }
)

Also, make changes to the vite.config.ts file:

...
import fs from 'fs'

export default defineConfig({
  plugins: [
    vue(),
    inertia({ ssr: { enabled: false } }),
    adonisjs({ entrypoints: ['inertia/app/app.ts', 'resources/js/app.js'], reloa…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Sa1ch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant