diff --git a/mcpgateway/services/gateway_service.py b/mcpgateway/services/gateway_service.py index af8f9607e..67652c5ba 100644 --- a/mcpgateway/services/gateway_service.py +++ b/mcpgateway/services/gateway_service.py @@ -799,6 +799,20 @@ async def update_gateway(self, db: Session, gateway_id: str, gateway_update: Gat gateway.transport = gateway_update.transport if gateway_update.tags is not None: gateway.tags = gateway_update.tags + if gateway_update.passthrough_headers is not None: + if isinstance(gateway_update.passthrough_headers, list): + gateway.passthrough_headers = gateway_update.passthrough_headers + else: + if isinstance(gateway_update.passthrough_headers, str): + parsed = [h.strip() for h in gateway_update.passthrough_headers.split(",") if h.strip()] + gateway.passthrough_headers = parsed + else: + raise GatewayError( + "Invalid passthrough_headers format: must be list[str] or comma-separated string") + + logger.info( + "Updated passthrough_headers for gateway {gateway.id}: {gateway.passthrough_headers}" + ) if getattr(gateway, "auth_type", None) is not None: gateway.auth_type = gateway_update.auth_type