Eptagone / Vite.AspNetCore

Small library to integrate Vite into ASP.NET projects
MIT License
243 stars 34 forks source link

Proxy is stripping cache headers #122

Open ProTip opened 3 months ago

ProTip commented 3 months ago

This is a really awesome project; thanks for creating!

Currently the proxy strategy results in stripping Vite dev server response headers. Vite uses caching/etags heavily to boost page load performance, and so there is quite a hit in performance with the headers missing(1.2s vs 150ms in my current app). Without the headers Chrome re-fetches all the source files on page load, and the V8 compilation cache is never used.

For now I'm pointing the scripts in index.html directly to the Vite server, and have the origin configured so it serves assets pointing back to itself. This appears to be working fine for now and is resulting in properly cached assets.

I'm wondering if something like YARP could help wrangle some of the proxy logic.