I'm trying to use Vite dev server in a cloud-based development environment where I can serve on and connect to ports, but need to access them through a proxy path.
Instead of http://localhost:3000/index.html I would visit e.g. https://my.cool.example.com/proxy/3000/index.html. Under the hood, the cloud service translates the URL and proxies the connection through: So to Vite it looks like I'm just requesting /index.html.
...But the various configs I've tried in vite.config.js haven't got this working properly yet:
- Setting
baseas suggested in this answer complains "The server is configured with a public base URL of /proxy/3000/" - Several other unsuccessful experiments with
server.base,proxy,publicPathand similar
How can I tell Vite that the client and assets should set a path prefix on requests, but the server can serve from root?