HTTPS for Vite

A friendly guide to enabling HTTPS for local Vite development

1 min read
March 18, 2026 · DevOps · Hasin Hayder

Sometimes, you need your local Vite server to run over HTTPS—maybe you're working with APIs that require secure origins, or testing features like service workers and cookies that behave differently on HTTPS.

Quick video

Setting this up is easy with the vite-plugin-mkcert package. You can install it using your preferred package manager:

bun add -D vite-plugin-mkcert
# or
npm install --save-dev vite-plugin-mkcert
# or
pnpm add -D vite-plugin-mkcert
# or
yarn add -D vite-plugin-mkcert

Next, in your vite.config.ts or vite.config.js file just import mkcert from vite-plugin-mkcert and add mkcert() in the plugins section.

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import mkcert from "vite-plugin-mkcert"
import tailwindcss from '@tailwindcss/vite'

export default defineConfig({
  plugins: [
    vue(), 
    tailwindcss(), 
    mkcert()
  ],
})

That's it! The mkcert plugin takes care of generating certificates and starts your vite dev server over HTTPS. Your browser will trust the certificate, so you can test secure features without any hassle.

Now start your vite development server and enjoy local HTTPS!

Hasin Hayder

Written by

Hasin Hayder

Writing about code, design, and building things

More from Hasin Hayder

ডালু ইমলি কমিকস এর ওয়েবসাইট শুরু করলাম আমরা

কমিকসের ওয়েবসাইট, তাও আবার মাত্র ৫ ঘণ্টায়? ভাবছেন, এ তো অসম্ভব! কিন্তু ডালু-ইমলি কমিকসের নতুন ওয়েবসাইটটা আমরা ঠিক এইটুকু সময়ের মধ্যেই তৈরি করে ফেলেছি। কীভাবে এই ম্যাজিক সম্ভব হলো, আর এর পেছনের সহজ কৌশলগুলো কী কী?

May 6, 2026 · 1 min read

AI কোডিং এর খরচ কমাবেন কিভাবে

প্রতি মাসে এআই কোডিংয়ের পেছনে আপনার খরচ কি অকারণে বাড়ছে? বেশিরভাগ সময় ছোট কিছু ভুল অভ্যাসের কারণেই বিল কয়েক গুণ বেড়ে যায়। অথচ সামান্য কিছু কৌশল মেনে চললেই এআই ব্যবহারের খরচ অর্ধেক কমিয়ে আনা সম্ভব। আপনার অজান্তেই কোথায় টাকা নষ্ট হচ্ছে, তা কি জানেন?

Apr 30, 2026 · 1 min read
Back to all articles

Comments

Be the first to leave a comment.

Leave a Comment

Your comment will be held for moderation before appearing.

Solve 0 + 0 =