fix: remove gzip do Express para evitar conflito com Traefik
O Traefik (coolify-proxy) já gerencia o gzip compression. Removendo do Express para evitar conflito e dupla compressão.
This commit is contained in:
parent
4dcecd3e63
commit
cfb60b2d4b
|
|
@ -1,7 +1,6 @@
|
||||||
import express, { type Express } from "express";
|
import express, { type Express } from "express";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import compression from "compression";
|
|
||||||
|
|
||||||
export function serveStatic(app: Express) {
|
export function serveStatic(app: Express) {
|
||||||
const distPath = path.resolve(__dirname, "public");
|
const distPath = path.resolve(__dirname, "public");
|
||||||
|
|
@ -11,15 +10,9 @@ export function serveStatic(app: Express) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable gzip compression for all responses
|
// NOTA: Gzip é gerenciado pelo Traefik (coolify-proxy)
|
||||||
app.use(compression({
|
// Não usar middleware compression aqui para evitar conflito
|
||||||
level: 6, // balance between speed and compression
|
// O Traefik já tem: traefik.http.middlewares.gzip.compress=true
|
||||||
filter: (req, res) => {
|
|
||||||
// Compress all JSON and static assets
|
|
||||||
if (req.headers['x-no-compression']) return false;
|
|
||||||
return compression.filter(req, res);
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Serve static files with proper caching
|
// Serve static files with proper caching
|
||||||
app.use(express.static(distPath, {
|
app.use(express.static(distPath, {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue