HTTP request node - authentication keeps turning itself back on

Bit of a strange one.

Recently I noticed my "turn on the radio" buttons stopped working. These are HTTP request nodes that call my squeezebox server to start playing an audio favourite.

When I investigated, I double-checked the URL by copy-pasting it into a browser, and sure enough this starts the radio as expected. But when I press a Node-RED dashboard button or inject a message, it doesn't work.

I noticed the basic authentication was turned on. Odd, because I had never set this up.

I turned it off, re-deployed, and it stayed off. Then next time I went to edit the node, it had magically turned itself back on.

See video: https://youtu.be/hcfvKrkLNZ4

Any ideas?!

Hi Mat (@hazymat),

Seems you are running an older version of Node-RED, since on more recent versions the http-request node offers multiple authentication types:

image

But in the new version of the http-request node I can reproduce the same issue!

  1. I have username (sdfsf) and password.

  2. Then I unselect the 'use authentication'.

  3. The I deploy and when I reopen the config screen the credentials are indeed erased (in the oneditprepare):

    image

    So the checkbox is unselected.

  4. I press 'Done' and reopen the config screen again, but now the username is again available (in oneditprepare):

    image

  5. As a result, you arrive at this line which will reactivate the checkbox again:

    image

That is the cause.
But unfortunately my time is up for today ...

Perhaps something to do with chrome auto fill repopulating the user field?

Anyhow, I'd suggest raising an issue on GitHub. There maybe a need for the author to add a bool var to remember it was selected/unselected rather than assuming the user wants to use authentication if the username or password has a value?

I cannot reproduce it here with either Chrome or Firefox.

The code explicitly sets the fields to blank strings when you untick the box - https://github.com/node-red/node-red/blob/cc051544f95501c7a24da2b78a511963a71d61ad/packages/node_modules/%40node-red/nodes/core/io/21-httprequest.html#L136-L139

So this could be the auto-fill issue. Raising an issue won't add anything to help resolve that.

Perhaps not but wouldn't using a var to remember users choice circumvent this?

To be a little more clear, in the server side, don't use auth if bool var is NOT true

Hi guys,
It might indeed be related to auto-fill, because from time to time I get a popup (which I have never seen in the past):

image

Now I'm really off ...

The blue background to the field was also a clue from your earlier screenshot.

Thanks

  • I've upgraded to latest Node-RED
  • Removed the managed password for the IP address in the browser

Now it no longer sets the "use authentication".

However my GET URL doesn't seem to work. When I paste URL into the browser, music starts. But when I inject, it no longer works to start the music.

How can I start to troubleshoot this?

Hi Mat,
Did you have luck meanwhile, or are you still stuck. I assume you have already added a debug node to the output of your http-request node? Does that give any clue?

I have just released version 2.0.1 of the node-red-contrib-http-logger, since the previous version didn't support recent NodeJs versions. Don't know if that could somehow be of any help for your troubleshooting? But (at least if my new version works correctly) then you could compare the request send by the http-request node, and the request send by the browser (via your browser's developer tools) when you specify the url directly.

Hi @BartButenaers! Nice to hear from you.

I was having another problem last night with Node-RED not deploying properly:

Deploy Failed: no response from server

(almost every time I tried to deploy).

I did the following, and all my problems have now gone:

  • Update Node-RED to latest version
  • Deleted all stored passwords in Chrome (resolved issue where box was getting re-ticked)
  • Rebooted the server (resolved the http request node not working AND deploy failed)
1 Like

Sooo.. I had the same issue and for me going into chromes settings and deleting the autofill stuff related to my node-red url solved it to me.

3 Likes