Configure traefik subdomain and dev tunnel support
- docker-compose: rename HostRegexp to leadscore-rashidulyn.+ for unique routing - vite.config: add proxy prefix rewriter and HMR settings for code-server tunnel Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8491537195
commit
ddfaf56722
@ -66,11 +66,11 @@ services:
|
||||
- traefik.docker.network=dokploy-network
|
||||
- traefik.http.routers.leadscore-http.entrypoints=web
|
||||
- traefik.http.routers.leadscore-http.priority=20
|
||||
- traefik.http.routers.leadscore-http.rule=HostRegexp(`leadscore.+`)
|
||||
- traefik.http.routers.leadscore-http.rule=HostRegexp(`leadscore-rashidulyn.+`)
|
||||
- traefik.http.routers.leadscore-http.service=leadscore
|
||||
- traefik.http.routers.leadscore-https.entrypoints=websecure
|
||||
- traefik.http.routers.leadscore-https.priority=20
|
||||
- traefik.http.routers.leadscore-https.rule=HostRegexp(`leadscore.+`)
|
||||
- traefik.http.routers.leadscore-https.rule=HostRegexp(`leadscore-rashidulyn.+`)
|
||||
- traefik.http.routers.leadscore-https.service=leadscore
|
||||
- traefik.http.routers.leadscore-https.tls=true
|
||||
- traefik.http.services.leadscore.loadbalancer.server.port=80
|
||||
|
||||
@ -1,21 +1,47 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { defineConfig, type PluginOption } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import path from 'node:path';
|
||||
|
||||
const PROXY_PREFIX = process.env.VITE_PROXY_PREFIX ?? '';
|
||||
|
||||
function reAddPrefix(prefix: string): PluginOption {
|
||||
if (!prefix) return null;
|
||||
return {
|
||||
name: 'tunnel-prefix-rewriter',
|
||||
configureServer(server) {
|
||||
server.middlewares.use((req, _res, next) => {
|
||||
if (req.url && !req.url.startsWith(prefix)) {
|
||||
req.url = prefix + req.url;
|
||||
}
|
||||
next();
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
base: process.env.VITE_BASE ?? '/',
|
||||
plugins: [vue()],
|
||||
plugins: [vue(), reAddPrefix(PROXY_PREFIX)],
|
||||
resolve: {
|
||||
alias: { '@': path.resolve(__dirname, 'src') },
|
||||
},
|
||||
server: {
|
||||
port: 3000,
|
||||
host: true,
|
||||
port: 3001,
|
||||
strictPort: true,
|
||||
allowedHosts: ['code.telecom.quest', '.telecom.quest'],
|
||||
hmr: { host: 'code.telecom.quest', clientPort: 443, protocol: 'wss', path: '/proxy/3001/' },
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
target: 'http://localhost:8082',
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/api/, ''),
|
||||
},
|
||||
[`${PROXY_PREFIX}/api`]: {
|
||||
target: 'http://localhost:8082',
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(new RegExp(`^${PROXY_PREFIX}/api`), ''),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user