Skip to content

Atlantis-Systems/vite-dev-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ViteDevProxy

A .NET library that provides easy integration of Vite development server proxying in ASP.NET Core applications using YARP (Yet Another Reverse Proxy).

Installation

dotnet add package ViteDevProxy

Usage

Basic Setup

Add ViteDevProxy to your ASP.NET Core application:

using ViteDevProxy;

var builder = WebApplication.CreateBuilder(args);

// Add ViteDevProxy services (defaults to http://localhost:5173/)
builder.Services.AddViteDevProxy();

var app = builder.Build();

// Map the reverse proxy
app.MapViteDevProxy();

app.Run();

Custom Vite Dev Server URL

// Configure custom Vite dev server URL
builder.Services.AddViteDevProxy("http://localhost:3000/");

What it does

ViteDevProxy automatically configures YARP to:

  • Proxy all requests ({**catch-all}) to your Vite development server
  • Handle WebSocket connections for Hot Module Replacement (HMR)
  • Maintain proper headers and request context

Development Workflow

  1. Start your Vite development server:

    npm run dev
  2. Start your ASP.NET Core application with ViteDevProxy configured

  3. Access your application through the ASP.NET Core server - all frontend requests will be automatically proxied to Vite

Requirements

  • .NET 10.0
  • Vite development server running (typically on port 5173)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages