HTTP Endpoint Node no IP info about client/caller?

Hallo,

I'm setting up a HTTP node and I'm wondering if there is really no info about the IP of the client?

Nodes:
[{"id":"f7a89e10.8bd628","type":"http in","z":"b451655f.5db818","name":"","url":"/HTTPTest","method":"get","upload":false,"swaggerDoc":"","x":230,"y":600,"wires":[["ab80428a.a215a","6712c19f.c82958"]]},{"id":"ab80428a.a215a","type":"http response","z":"b451655f.5db818","name":"","statusCode":"","headers":{},"x":230,"y":660,"wires":[]},{"id":"6712c19f.c82958","type":"debug","z":"b451655f.5db818","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":430,"y":600,"wires":[]}]

Called via:
http://192.168.178.21:1880/HTTPTest?test=test

Resulting JSON

{
  "_msgid": "615cfe19.49f0e",
  "payload": {
    "test": "test"
  },
  "req": {
    "_readableState": {
      "objectMode": false,
      "highWaterMark": 16384,
      "buffer": {
        "head": null,
        "tail": null,
        "length": 0
      },
      "length": 0,
      "pipes": null,
      "pipesCount": 0,
      "flowing": true,
      "ended": true,
      "endEmitted": true,
      "reading": false,
      "sync": true,
      "needReadable": false,
      "emittedReadable": false,
      "readableListening": false,
      "resumeScheduled": false,
      "emitClose": true,
      "autoDestroy": false,
      "destroyed": false,
      "defaultEncoding": "utf8",
      "awaitDrainWriters": null,
      "multiAwaitDrain": false,
      "readingMore": true,
      "decoder": null,
      "encoding": null
    },
    "readable": false,
    "_events": {},
    "_eventsCount": 1,
    "socket": "[internal]",
    "connection": "[internal]",
    "httpVersionMajor": 1,
    "httpVersionMinor": 1,
    "httpVersion": "1.1",
    "complete": true,
    "headers": {
      "host": "192.168.178.21:1880",
      "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0",
      "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
      "accept-language": "de,en-US;q=0.7,en;q=0.3",
      "accept-encoding": "gzip, deflate",
      "dnt": "1",
      "connection": "keep-alive",
      "upgrade-insecure-requests": "1",
      "if-none-match": "W/\"f-SzkCEKs7NV6rxiz4/VbpzPnLKEM\"",
      "cache-control": "max-age=0"
    },
    "rawHeaders": [
      "Host",
      "192.168.178.21:1880",
      "User-Agent",
      "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0",
      "Accept",
      "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
      "Accept-Language",
      "de,en-US;q=0.7,en;q=0.3",
      "Accept-Encoding",
      "gzip, deflate",
      "DNT",
      "1",
      "Connection",
      "keep-alive",
      "Upgrade-Insecure-Requests",
      "1",
      "If-None-Match",
      "W/\"f-SzkCEKs7NV6rxiz4/VbpzPnLKEM\"",
      "Cache-Control",
      "max-age=0"
    ],
    "trailers": {},
    "rawTrailers": [],
    "aborted": false,
    "upgrade": false,
    "url": "/HTTPTest?test=test",
    "method": "GET",
    "statusCode": null,
    "statusMessage": null,
    "client": "[internal]",
    "_consuming": false,
    "_dumped": true,
    "baseUrl": "",
    "originalUrl": "/HTTPTest?test=test",
    "_parsedUrl": {
      "protocol": null,
      "slashes": null,
      "auth": null,
      "host": null,
      "port": null,
      "hostname": null,
      "hash": null,
      "search": "?test=test",
      "query": "test=test",
      "pathname": "/HTTPTest",
      "path": "/HTTPTest?test=test",
      "href": "/HTTPTest?test=test",
      "_raw": "/HTTPTest?test=test"
    },
    "params": {},
    "query": {
      "test": "test"
    },
    "res": "[internal]",
    "body": {},
    "_parsedOriginalUrl": {
      "protocol": null,
      "slashes": null,
      "auth": null,
      "host": null,
      "port": null,
      "hostname": null,
      "hash": null,
      "search": "?test=test",
      "query": "test=test",
      "pathname": "/HTTPTest",
      "path": "/HTTPTest?test=test",
      "href": "/HTTPTest?test=test",
      "_raw": "/HTTPTest?test=test"
    },
    "route": {
      "path": "/HTTPTest",
      "stack": [
        {
          "name": "cookieParser",
          "keys": [],
          "regexp": {
            "fast_star": false,
            "fast_slash": false
          },
          "method": "get"
        },
        {
          "name": "httpMiddleware",
          "keys": [],
          "regexp": {
            "fast_star": false,
            "fast_slash": false
          },
          "method": "get"
        },
        {
          "name": "corsHandler",
          "keys": [],
          "regexp": {
            "fast_star": false,
            "fast_slash": false
          },
          "method": "get"
        },
        {
          "name": "metricsHandler",
          "keys": [],
          "regexp": {
            "fast_star": false,
            "fast_slash": false
          },
          "method": "get"
        },
        {
          "name": "<anonymous>",
          "keys": [],
          "regexp": {
            "fast_star": false,
            "fast_slash": false
          },
          "method": "get"
        },
        {
          "name": "<anonymous>",
          "keys": [],
          "regexp": {
            "fast_star": false,
            "fast_slash": false
          },
          "method": "get"
        }
      ],
      "methods": {
        "get": true
      }
    },
    "cookies": {},
    "signedCookies": {}
  },
  "res": {}
}

Did I miss an option to get an info which IP is accessing the HTTP Endpoint?

The full object is not reported in the debug, look at msg.req.ip

1 Like

Thanks for the fast reply. It works perfectly.

But why is the full Objekt not reported? I've set the debug node to print the whole message.

This thread explains more.

It is not only very big but also contains circular references that aren't easily handled in display.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.