HTTP Node Connection Help (Digest Auth)

I am trying to connect to the API for a smart device.

It works in my browser but I get 504 errors when trying to connect within n8n. I’ve configured digestAuth credentials which work fine in my browser when tested.

They have also provided a curl command to test:

`curl --digest -u **XXX**:**PASSWORD** -H 'accept: 
application/json' -H 'content-type: application/json'  --compressed 
'https://123.com'`

This is my HTTP node config:

{
  "nodes": [
    {
      "parameters": {
        "authentication": "digestAuth",
        "url": "xxx",
        "jsonParameters": true,
        "options": {
          "fullResponse": true, //tried false
          "followAllRedirects": false, //tried true
          "followRedirect": false //tried true
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        460,
        300
      ],
      "credentials": {
        "httpDigestAuth": {
          "id": "44",
          "name": "credentials"
        }
      }
    }
  ],
  "connections": {}
}

Would love any suggestions :slight_smile:

Hey @automatron,

A 504 is normally a timeout of some kind rather than a credential issue, it could be that the api you are using incorrectly responds with a 504 or it could be an odd header issue.

What version of n8n are you running and how do you have it installed?

1 Like

Hey @jon :wave: running 0.152 via docker. Other HTTP requests are working fine so I’m stumped

Updated to add:
I’ve taken a closer look at the request from my browser and it has more info in the header fields. Maybe I need to include some of this with my request from n8n?


Digest username="<removed>", realm="<removed>, nonce="<removed>", uri="<removed>", algorithm=MD5, response="<removed>", opaque="<removed>", qop=auth, nc=00000019, cnonce="<removed>"

Can you try adding a new environment variable for the option below to see if it helps (will need a container restart). If it doesn’t help remove the environment option.

N8N_USE_DEPRECATED_REQUEST_LIB=true

1 Like

:raised_hands: Yessss - this has worked! Thanks :slight_smile: Although does it need further investigation to see what’s changed between the new and old request library?

Yes, there is a known bug with digest auth. We already have an open PR with the fix which will be released with the next version.

2 Likes

Fix got released with [email protected]

2 Likes