fix: Proxy for http
This commit is contained in:
@@ -12,12 +12,7 @@ export const post: RequestHandler = async (event) => {
|
||||
|
||||
try {
|
||||
const service = await db.getService({ id, teamId });
|
||||
const {
|
||||
destinationDockerId,
|
||||
destinationDocker,
|
||||
fqdn,
|
||||
minio: { publicPort }
|
||||
} = service;
|
||||
const { destinationDockerId, destinationDocker } = service;
|
||||
await db.updateMinioService({ id, publicPort: null });
|
||||
if (destinationDockerId) {
|
||||
const engine = destinationDocker.engine;
|
||||
@@ -30,11 +25,6 @@ export const post: RequestHandler = async (event) => {
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
try {
|
||||
await stopTcpHttpProxy(destinationDocker, publicPort);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -37,6 +37,7 @@ export const get: RequestHandler = async (event) => {
|
||||
const service = await db.prisma.service.findFirst({ where: { id } });
|
||||
if (service?.fqdn) {
|
||||
const domain = getDomain(service.fqdn);
|
||||
const isHttps = service.fqdn.startsWith('https://');
|
||||
traefik = {
|
||||
[type]: {
|
||||
routers: {
|
||||
@@ -55,6 +56,19 @@ export const get: RequestHandler = async (event) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
if (isHttps) {
|
||||
if (dev) {
|
||||
traefik[type].routers[id].tls = {
|
||||
domains: {
|
||||
main: `${domain}`
|
||||
}
|
||||
};
|
||||
} else {
|
||||
traefik[type].routers[id].tls = {
|
||||
certresolver: 'letsencrypt'
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user