# Node-red behind Traefik proxy problem

**URL:** <https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763>\
**Category:** General\
**Tags:** security\
**Created:** [6 December 2022 13:04 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763 "2022-12-06T13:04:14Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterda](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@peterda](https://discourse.nodered.org/u/peterda)\
**Post date:** [6 December 2022 13:04 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/1 "2022-12-06T13:04:15Z")

</div>

I have my Node-Red installation behind a traefik proxy using basicAuth.  
With basicAuth middleware enabled i get the nodered banner and nothing more.  
fqdn/ui shows my UI and works.

When i disable basicAuth as middleware in traefik, the nodered flows and gui works as normal.

Anyone knows how to fix this? Have tested a lot, but came no closer to a solution.

Traefik proxy configuration:

```auto
http:
  routers:
    router1:
      entryPoints:
      - "websecure"
      service: "nodered"
      rule: "Host(`nodered.......com`)"
      tls:
        certresolver: "letsencrypt"
      middlewares:
        - "iotlogin"

    nodered:
      loadBalancer:
        servers:
        - url: "http://192.168.99.30:1880"

  middlewares:
    iotlogin:
      basicAuth:
        removeHeader: false
        headerField: "X-WebAuth-User"
        users:
          - "test:1234"

```

The above config does not work , after removing the following, it works:

```auto
      middlewares:
        - "iotlogin"

```

Note that eg. are configuration items i have experimented with:

```auto
        removeHeader: false
        headerField: "X-WebAuth-User"

```

The same configuration works flawless with HomeAssistant.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [6 December 2022 19:07 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/2 "2022-12-06T19:07:33Z")

</div>

Not ever used Traefik as I use NGINX but I rather imagine that it means that the iotlogin function is failing. But without knowing more about what that is, hard to say. Isn't there any log output?

---

<div class="post-metadata">

**Author:** ![peterda](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@peterda](https://discourse.nodered.org/u/peterda)\
**Post date:** [7 December 2022 12:06 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/3 "2022-12-07T12:06:00Z")

</div>

This is the error message in the browser console:

```auto
Source map error: Error: request failed with status 404
Resource URL: https://nodered......com/vendor/vendor.js?v=3.0.2
Source Map URL: purify.min.js.map

Error: Promised response from onMessage listener went out of scope

```

The vendor.js is accessible via the proxy.

Firefox, shows the black banner line.  
Safari, shows the Node-red login dialogue but does not accept the username/password combination.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [7 December 2022 12:37 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/4 "2022-12-07T12:37:46Z")

</div>

I suspect that the source map error isn't the issue here. That is really just a warning that the js files source map can't be found. It doesn't stop anything from working since a source map is purely optional.

But I don't think that the problem is at the browser end anyway. The actual problem, as I said, is almost certainly in the "iotlogin" middleware. You need to understand what that is or isn't doing and whether it is generating any log output on the server.

---

<div class="post-metadata">

**Author:** ![peterda](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@peterda](https://discourse.nodered.org/u/peterda)\
**Post date:** [8 December 2022 07:50 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/5 "2022-12-08T07:50:02Z")

</div>

Thanks you for you time.  
I will investigate further.

Cheers Peter

---

<div class="post-metadata">

**Author:** ![ozett](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ozett/32/28862_2.png) [@ozett](https://discourse.nodered.org/u/ozett)\
**Post date:** [17 January 2023 18:32 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/6 "2023-01-17T18:32:02Z")

</div>

any insights on this?

---

<div class="post-metadata">

**Author:** ![peterda](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@peterda](https://discourse.nodered.org/u/peterda)\
**Post date:** [18 January 2023 12:29 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/7 "2023-01-18T12:29:38Z")

</div>

No, i have not been pursuing a solution actively.  
There are other issues that need more attention then this one.

Any hints to solve this are welcome though 🙂

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 January 2023 13:18 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/8 "2023-01-18T13:18:46Z")

</div>

> [@peterda](#):
>
> Any hints to solve this are welcome though

You mean beyond the one I already gave? 😉

---

<div class="post-metadata">

**Author:** ![ozett](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ozett/32/28862_2.png) [@ozett](https://discourse.nodered.org/u/ozett)\
**Post date:** [18 January 2023 16:30 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/9 "2023-01-18T16:30:37Z")

</div>

the error your showed with purifi.min.js is somehow discussed and solved here:

> **[Docker label \`forceslash=true\` doesn't seem to work](https://community.traefik.io/t/docker-label-forceslash-true-doesnt-seem-to-work/4185)**
>
> Here below a description of my problem: What did you do? In chrome browser I entered https:///node-red What did you expect to see? After entering my traefik basic authentication credentials (I don't need to enter them always - they seem to be...

another thing is the auth-users.  
pwd must me encrypted, not like your example - "test:1234"  
see docu: [Traefik BasicAuth Documentation - Traefik](https://doc.traefik.io/traefik/middlewares/http/basicauth/#general)

the pwd-hash must not be escaped in .yaml config,  
but if the label-directive is used special chars must be escaped.  
there is a lot on the web for this

does anything of this help?

edit:  
spend 1/2 day with my config: that helped mit with the slash  
-\> [Need URL rewrite to add trailing slash · Issue #563 · traefik/traefik · GitHub](https://github.com/traefik/traefik/issues/563#issuecomment-421477354)

---

<div class="post-metadata">

**Author:** ![peterda](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@peterda](https://discourse.nodered.org/u/peterda)\
**Post date:** [24 January 2023 10:16 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/10 "2023-01-24T10:16:29Z")

</div>

Hi,

Thanks for the reply.

> [@ozett](#):
>
> pwd must me encrypted, not like your example - "test:1234"

This is only a placeholder, i know i need to generate a hashed version.

> [@ozett](#):
>
> edit:  
> spend 1/2 day with my config: that helped mit with the slash  
> -\> [Need URL rewrite to add trailing slash · Issue #563 · traefik/traefik · GitHub](https://github.com/traefik/traefik/issues/563#issuecomment-421477354)

This gives some nice insights, but i need to apply it to my installation.  
My Node-red installation is not on the same machine as my traefik is.

Cheers, thanks !

---

<div class="post-metadata">

**Author:** ![ozett](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ozett/32/28862_2.png) [@ozett](https://discourse.nodered.org/u/ozett)\
**Post date:** [24 January 2023 11:46 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/11 "2023-01-24T11:46:45Z")

</div>

my node-red instances are also on separate hardware.  
so a redirect from traefik to the node-red makes it working.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/6/2643bc661c50cbe1a715924b654039d598e87d2b.png)

good luck! cheers

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [25 March 2023 11:47 UTC](https://discourse.nodered.org/t/node-red-behind-traefik-proxy-problem/71763/12 "2023-03-25T11:47:00Z")

</div>

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