Nginx Proxy Manager results in "ERR_TOO_MANY_REDIRECTS" for one host?

Hello!

I managed to get the Duckdns integration and Nginx Proxy Manager to work for Home Assistant (HassOS installation on Pi 4).
So my Home Assistant is available locally via http and from extern via https://..duckdns.org.

No problem so far.
I tried it for another device (another Pi with deCONZ) and that worked also without any problem.

But then I tried to create another redirection for another local device (a NAS).
So I set the same things as for the Home Assistant Pi and then I tried to reach the NAS from outside. But I am getting the error in the Browser: “ERR_TOO_MANY_REDIRECTS”.

This is the configuration in Nginx Proxy Manager:
Bildschirmfoto 2020-06-20 um 22.50.23

This is the SSL page:
Bildschirmfoto 2020-06-20 um 22.52.04

What can I to to let it work?

One thing i noticed is you use Port 8080 which for me is taken by Nginx Proxy Manager itself.
The other thing try to add this

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $remote_addr;
real_ip_header X-Real-IP;
real_ip_recursive on;

at the advanced settings.

I only saw under Configuration of Nginx the ports 443, 80 and 81.
But I will try your additions. Only in the moment I don’t get Nginx Proxy Manager to start after a reboot of the HA-Pi.
I can find the following in the supervisor log:

20-06-20 21:19:28 ERROR (SyncWorker_1) [supervisor.docker] Can't start addon_a0d7b954_nginxproxymanager: 500 Server Error: Internal Server Error ("driver failed programming external connectivity on endpoint addon_a0d7b954_nginxproxymanager (f7e664fee1382542a4dca8df9ed7f9ee47057b9567ac7c72d2c85800fb228a1a): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use")

I changed the port 80 for Nginx to 8088, because I have “Emulated Hue” also running on this Pi and that uses port 80.

I added the things you posted to the advanced setting, but nothing changes.

I found the problem. I had switched on in my NAS that only https connections should be possible. So the NAS itself is making a redirection.
After switching it off, the URL via HA and Nginx is working fine!
But only in Chrome, Opera or Vivaldi! If I try it in Safari I am getting a very strange page with a few fields that doesn’t make sense.

If I use Chrome I see that after the input of:

https://xxxxxx.yyyyyy.duckdns.org

shortly a few other URL can be seen (that that can be seen in Safari below) and then I see:

https://xxxxxx.yyyyyy.duckdns.org/cgi-bin/

In Safari I see after the given URL the following:

https://xxxxxx.yyyyyy.duckdns.org/cgi-bin/login.html?1592689296

and that’s it.

This is the Nginx log from both browsers:
Chrome:

[20/Jun/2020:23:54:33 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/redirect.html?count=0.16217617018299335" [Client <external IP>] [Length 548] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/"
[20/Jun/2020:23:54:33 +0200] - 302 302 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/QTS.cgi?count=464601" [Client <external IP>] [Length 0] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/redirect.html?count=0.16217617018299335"
[20/Jun/2020:23:54:33 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/login.html?1592690071" [Client <external IP>] [Length 2524] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/redirect.html?count=0.16217617018299335"
[20/Jun/2020:23:54:33 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/v3_menu/css/qts-font.css?_dc=1590700741" [Client <external IP>] [Length 253] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592690071"
[20/Jun/2020:23:54:33 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/loginTheme/theme1/login.css?r=form&1590700741" [Client <external IP>] [Length 3872] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592690071"
[20/Jun/2020:23:54:33 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/loginTheme/theme1/login.js?1590700741" [Client <external IP>] [Length 7159] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592690071"
[20/Jun/2020:23:54:33 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/js/qos-core-login.js?1590700741" [Client <external IP>] [Length 8743] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592690071"
[20/Jun/2020:23:54:33 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/loginTheme/theme1/login-max-height-768.css?r=wall&1590700741" [Client <external IP>] [Length 164] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592690071"
[20/Jun/2020:23:54:33 +0200] - 200 200 - POST https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/authLogin.cgi" [Client <external IP>] [Length 3774] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/"
[20/Jun/2020:23:54:33 +0200] - 200 200 - POST https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/authLogin.cgi" [Client <external IP>] [Length 3774] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/"
[20/Jun/2020:23:54:33 +0200] - 200 200 - POST https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/sysinfoReq.cgi?qpkg=1" [Client <external IP>] [Length 1653] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/"

Safari:

[20/Jun/2020:23:52:43 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/redirect.html?count=0.7415010059844935" [Client <external IP>] [Length 548] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/"
[20/Jun/2020:23:52:43 +0200] - 302 302 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/QTS.cgi?count=518843" [Client <external IP>] [Length 0] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/redirect.html?count=0.7415010059844935"
[20/Jun/2020:23:52:43 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/login.html?1592689961" [Client <external IP>] [Length 2524] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/redirect.html?count=0.7415010059844935"
[20/Jun/2020:23:52:43 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/v3_menu/css/qts-font.css?_dc=1590700741" [Client <external IP>] [Length 253] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592689961"
[20/Jun/2020:23:52:43 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/loginTheme/theme1/login-max-height-768.css?r=wall&1590700741" [Client <external IP>] [Length 164] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592689961"
[20/Jun/2020:23:52:43 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/loginTheme/theme1/login.js?1590700741" [Client <external IP>] [Length 7159] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592689961"
[20/Jun/2020:23:52:43 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/js/qos-core-login.js?1590700741" [Client <external IP>] [Length 8743] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592689961"
[20/Jun/2020:23:52:43 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/loginTheme/theme1/login.css?r=form&1590700741" [Client <external IP>] [Length 3872] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592689961"
[20/Jun/2020:23:52:43 +0200] - 200 200 - GET https xxxxxxx.yyyyyyy.duckdns.org "/cgi-bin/images/mobile/logo_16.ico?1590700741" [Client <external IP>] [Length 1150] [Gzip -] [Sent-to 192.168.178.101] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" "https://xxxxxxx.yyyyyyy.duckdns.org/cgi-bin/login.html?1592689961"

It seems that Safari is simply stopping the communication, but I don’t know why.