feat: add request header logging to dev and prod servers
All checks were successful
Build and Push Presejpacky Docker Image / build-and-push (push) Successful in 7s
All checks were successful
Build and Push Presejpacky Docker Image / build-and-push (push) Successful in 7s
This commit is contained in:
@@ -9,6 +9,13 @@ const __dirname = path.dirname(__filename);
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// Log all incoming request methods, URLs, and headers
|
||||
app.use((req, res, next) => {
|
||||
console.log(`[Express Request] ${req.method} ${req.url}`);
|
||||
console.log('Headers:', JSON.stringify(req.headers, null, 2));
|
||||
next();
|
||||
});
|
||||
|
||||
// Middleware to strip base path prefix from request headers if present
|
||||
app.use((req, res, next) => {
|
||||
const prefix = (req.headers['x-forwarded-prefix'] as string) || (req.headers['x-base-path'] as string) || '';
|
||||
|
||||
Reference in New Issue
Block a user