🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

vite-plugin-tunnel-proxy

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-tunnel-proxy

A proxy plugin for vite that works with https and SwitchyOmega

0.1.4
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-tunnel-proxy

A vite plugin that (at least for me) solves the problem of developing locally with browser based tunnel proxies like SwitchyOmega and https.

Usage

1. Install

yarn add --dev vite-plugin-tunnel-proxy

2. Configuration

2.1 Create a certificate and configure vite

I recommend using mkcert to generate locally trusted certificates.

mkcert install
mkcert -key-file .ssh.local/key.pem -cert-file .ssh.local/cert.pem example.test localhost 127.0.0.1 ::1

And use them in the vite config:

import { defineConfig } from 'vite'
import vitePluginTunnelProxy from 'vite-plugin-tunnel-proxy'

export default defineConfig({
  server: {
    https: {
      key: './.ssh.local/key.pem',
      cert: './.ssh.local/cert.pem'
    }
  },
  plugins: [
    vitePluginTunnelProxy()
  ],
})

2.2 Configure SwitchyOmega

You can use whatever proxy you like, I prefer SwitchyOmega.

Create a new profile of the type Proxy Profile and configure it as follows:

ProtocolServerPort
HTTPlocalhost8080

Save and activate the profile (or add it to a Switch Profile). And voilà, application is being served on https://example.test with a valid certificate.

FAQs

Package last updated on 07 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts