Skip to content

Commit 5c9d60e

Browse files
committed
Add dev server proxy for legacy URL redirects
Vite proxy rewrites /truapi-explorer and /host-api-explorer paths to /truapi/ during development. In production the 404.html SPA fallback handles this instead.
1 parent 2f629b1 commit 5c9d60e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

vite.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,18 @@ function spa404Plugin(): Plugin {
2020
export default defineConfig({
2121
base: '/truapi/',
2222
plugins: [react(), tailwindcss(), spa404Plugin()],
23+
server: {
24+
// Redirect legacy base paths to /truapi/ during development.
25+
// In production, the 404.html SPA fallback handles this instead.
26+
proxy: {
27+
'/truapi-explorer': {
28+
target: 'http://localhost:5173',
29+
rewrite: (path) => path.replace(/^\/truapi-explorer/, '/truapi'),
30+
},
31+
'/host-api-explorer': {
32+
target: 'http://localhost:5173',
33+
rewrite: (path) => path.replace(/^\/host-api-explorer/, '/truapi'),
34+
},
35+
},
36+
},
2337
})

0 commit comments

Comments
 (0)