I use Vue Router to develop my single page application and use Vite to package my project. I want to deploy all static files (such as index.js
and index.css
) under another CDN domain name cdn.example.com
, so I used Vite Base command to build the code.
vite build --base http://cdn.example.com/
The main site of my website is http://example.com
, when I visit it, the static files will automatically access cdn.example.com
, and the website can be opened normally. But the route of the website has become http://example.com/http://cdn.example.com/
, and the route of Vue router is also invalid (that is, when I visit http://example.com/about
, it displays a 404). This confuses me, how should I fix this?