Merge pull request #16663 from dotboris/proxy-pass-log-level

Ensure that `http-proxy-middleware` logs requests when log level is set to `debug`
This commit is contained in:
Patrik Oldsberg
2023-03-08 16:52:59 +01:00
committed by GitHub
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-proxy-backend': patch
---
Ensure that `@backstage/plugin-proxy-backend` logs the requests that it proxies when log level is set to `debug`.
@@ -121,6 +121,11 @@ export function buildMiddleware(
// Attach the logger to the proxy config
fullConfig.logProvider = () => logger;
// http-proxy-middleware uses this log level to check if it should log the
// requests that it proxies. Setting this to the most verbose log level
// ensures that it always logs these requests. Our logger ends up deciding
// if the logs are displayed or not.
fullConfig.logLevel = 'debug';
// Only return the allowed HTTP headers to not forward unwanted secret headers
const requestHeaderAllowList = new Set<string>(