admin管理员组文章数量:1393920
My backend server has following routing:
/myapp/api/
- for api calls
/myapp/static/
- for assets
Anything that doesn't match this two must return index.html
, or 404
if file requested (to allow SPA to handle url's path).
So vite proxy server must handle all requests under /myapp
, but requests which are NOT started from /myapp/static/
must be redirected to backend server. All generated urls to assets (hrefs, imports, etc..) must have /myapp/static/
prefix.
So here is the issue:
If I set base: '/myapp/static/'
option in vite.config, vite stops serving /myapp/...whatever...
requests
I could set only base: '/myapp/'
and then configure proxy to redirect all requests except /myapp/static
to backend server. But in this case assets urls lack of /static/
segment.
So how to have /myapp/static
prefix for all assets paths, while still serving just /myapp/...whatever...
requests? I didn't found simple way to differ this two.
Or maybe my whole setup approach is just incorrect?
本文标签: single page applicationUrls to assets should be subpath of base path of vite proxyStack Overflow
版权声明:本文标题:single page application - Urls to assets should be subpath of base path of vite proxy - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744083049a2588007.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论