[ { "id": "custom-headers-tab", "type": "tab", "label": "POD Gateway ยท Custom headers", "disabled": false, "info": "One-tab local demo for dynamic custom headers on GET and POST requests. Start Redis first, then deploy and click either inject node." }, { "id": "custom-headers-server", "type": "pod-gateway-server-config", "name": "Central Gateway + Redis", "host": "0.0.0.0", "port": 8080, "path": "/ws", "redisUrl": "redis://127.0.0.1:6379", "redisRejectUnauthorized": true, "redisKeyPrefix": "pod-gateway-custom-headers-demo", "redisConsumer": "custom-headers-gateway", "redisMaxQueueSize": 10000, "redisResultTtlSeconds": 3600, "redisDeleteOnAck": true, "redisRetryPollMs": 250, "rateLimits": "{\"demo/get\":{\"rate\":10,\"burst\":10},\"demo/post\":{\"rate\":5,\"burst\":5}}", "concurrency": 4, "upstreamTimeoutMs": 60000, "maxAttempts": 0, "verboseLogging": true, "credentials": {} }, { "id": "custom-headers-api", "type": "pod-gateway-api-config", "name": "Local echo API", "baseUrl": "http://127.0.0.1:1880", "headers": "{\"Accept\":\"application/json\"}", "apiKeyHeader": "", "apiKeyPrefix": "", "credentials": {} }, { "id": "custom-headers-get-adapter", "type": "pod-gateway-adapter", "name": "GET echo adapter", "server": "custom-headers-server", "api": "custom-headers-api", "operation": "demo/get", "label": "Demo GET with custom headers", "path": "/pod-gateway-custom-headers/get", "method": "GET", "headers": "{}", "idempotencyHeader": "", "description": "Local GET endpoint that echoes the custom headers received by the central Gateway." }, { "id": "custom-headers-post-adapter", "type": "pod-gateway-adapter", "name": "POST echo adapter", "server": "custom-headers-server", "api": "custom-headers-api", "operation": "demo/post", "label": "Demo POST with custom headers", "path": "/pod-gateway-custom-headers/post", "method": "POST", "headers": "{}", "idempotencyHeader": "", "description": "Local POST endpoint that echoes the custom headers and JSON body received by the central Gateway." }, { "id": "custom-headers-get-http-in", "type": "http in", "z": "custom-headers-tab", "name": "Fake upstream GET", "url": "/pod-gateway-custom-headers/get", "method": "get", "upload": false, "swaggerDoc": "", "x": 150, "y": 520, "wires": [["custom-headers-get-upstream"]] }, { "id": "custom-headers-get-upstream", "type": "function", "z": "custom-headers-tab", "name": "Echo GET headers", "func": "const headers = msg.req?.headers || {}\nmsg.payload = {\n received: 'GET',\n headers: {\n 'x-demo-client': headers['x-demo-client'],\n 'x-tenant-id': headers['x-tenant-id'],\n 'x-locale': headers['x-locale'],\n 'x-request-id': headers['x-request-id']\n }\n}\nreturn msg", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 520, "wires": [["custom-headers-get-http-response"]] }, { "id": "custom-headers-get-http-response", "type": "http response", "z": "custom-headers-tab", "name": "Return GET response", "statusCode": "", "headers": {}, "x": 640, "y": 520, "wires": [] }, { "id": "custom-headers-post-http-in", "type": "http in", "z": "custom-headers-tab", "name": "Fake upstream POST", "url": "/pod-gateway-custom-headers/post", "method": "post", "upload": false, "swaggerDoc": "", "x": 150, "y": 620, "wires": [["custom-headers-post-upstream"]] }, { "id": "custom-headers-post-upstream", "type": "function", "z": "custom-headers-tab", "name": "Echo POST headers and body", "func": "const headers = msg.req?.headers || {}\nmsg.payload = {\n received: 'POST',\n headers: {\n 'x-demo-client': headers['x-demo-client'],\n 'x-tenant-id': headers['x-tenant-id'],\n 'x-operation': headers['x-operation'],\n 'x-request-id': headers['x-request-id']\n },\n body: msg.payload\n}\nreturn msg", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 420, "y": 620, "wires": [["custom-headers-post-http-response"]] }, { "id": "custom-headers-post-http-response", "type": "http response", "z": "custom-headers-tab", "name": "Return POST response", "statusCode": "", "headers": {}, "x": 680, "y": 620, "wires": [] }, { "id": "custom-headers-gateway", "type": "pod-gateway-config", "name": "Local POD connector", "url": "ws://127.0.0.1:8080/ws", "podId": "pod-custom-headers-demo", "connectTimeout": 10000, "reconnectInterval": 3000, "verboseLogging": true, "credentials": {} }, { "id": "custom-headers-get-inject", "type": "inject", "z": "custom-headers-tab", "name": "Run GET with custom headers", "props": [{ "p": "payload" }], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "{\"tenantId\":\"get-tenant\",\"locale\":\"uk-UA\"}", "payloadType": "json", "x": 160, "y": 120, "wires": [["custom-headers-get-request"]] }, { "id": "custom-headers-get-request", "type": "function", "z": "custom-headers-tab", "name": "Set GET request headers", "func": "msg._request = {\n headers: {\n 'X-Demo-Client': 'node-red',\n 'X-Tenant-ID': '{{payload.tenantId}}',\n 'X-Locale': '{{payload.locale}}',\n 'X-Request-ID': '{{gateway.requestId}}'\n }\n}\nreturn msg", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 400, "y": 120, "wires": [["custom-headers-get-call"]] }, { "id": "custom-headers-get-call", "type": "pod-gateway-call", "z": "custom-headers-tab", "name": "Gateway Call: GET", "gateway": "custom-headers-gateway", "operation": "demo/get", "timeout": 60000, "priority": "normal", "x": 640, "y": 120, "wires": [["custom-headers-get-result"], ["custom-headers-get-error"]] }, { "id": "custom-headers-get-result", "type": "debug", "z": "custom-headers-tab", "name": "GET response and received headers", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 910, "y": 100, "wires": [] }, { "id": "custom-headers-get-error", "type": "debug", "z": "custom-headers-tab", "name": "GET gateway error", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 890, "y": 140, "wires": [] }, { "id": "custom-headers-post-inject", "type": "inject", "z": "custom-headers-tab", "name": "Run POST with custom headers", "props": [{ "p": "payload" }], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "{\"tenantId\":\"post-tenant\",\"name\":\"Ada\"}", "payloadType": "json", "x": 170, "y": 260, "wires": [["custom-headers-post-request"]] }, { "id": "custom-headers-post-request", "type": "function", "z": "custom-headers-tab", "name": "Set POST request headers and body", "func": "msg._request = {\n headers: {\n 'X-Demo-Client': 'node-red',\n 'X-Tenant-ID': '{{payload.tenantId}}',\n 'X-Operation': 'create',\n 'X-Request-ID': '{{gateway.requestId}}'\n },\n body: {\n name: msg.payload.name\n }\n}\nreturn msg", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 420, "y": 260, "wires": [["custom-headers-post-call"]] }, { "id": "custom-headers-post-call", "type": "pod-gateway-call", "z": "custom-headers-tab", "name": "Gateway Call: POST", "gateway": "custom-headers-gateway", "operation": "demo/post", "timeout": 60000, "priority": "normal", "x": 670, "y": 260, "wires": [["custom-headers-post-result"], ["custom-headers-post-error"]] }, { "id": "custom-headers-post-result", "type": "debug", "z": "custom-headers-tab", "name": "POST response and received headers", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 950, "y": 240, "wires": [] }, { "id": "custom-headers-post-error", "type": "debug", "z": "custom-headers-tab", "name": "POST gateway error", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 920, "y": 280, "wires": [] } ]