Hi,
I’m struggling to get the last steps of the nginx reverse proxy working as needed. I have an external ubuntu 18.04 server running nginx, with HA running on a RasPi. I have successfully installed certbot certs for the reverse proxy, and configured according to the HA documentation for reverse proxying:
And have set the configuration of HA as:
http:
base_url: https://hassio.fqdn/
use_x_forwarded_for: true
trusted_proxies:
- proxy.ip
I consistently get an error as below:
[[localize(‘ui.panel.page-authorize.initializing’)]]
when I attempt to access via the FQDN, so I appear to be connecting, but not fully (ie I can successfully proxy http, and log-in, but not when connecting via https), however the certificate is valid, and signed, so the problem does not (I believe) appear to be there. Thoughts gratefully received…
Hi @techwithjake - I hit return on the question a little early, have given a little more background - I’m testing on my internal network, but I do get the same externally or internally.
@techwithjake - thanks for this - I’ve had a quick look through, and while there’s a couple of minor differences, which I’ve now added, it seems to be pretty much the same as I have. I’ll spend a while longer looking in detail and reviewing to double check I’m not missing anything - I’ve had a few evenings looking at this now!
The one element which jumps out, is that I see you have is the API password in the HA config, but no reference in the nginx config - my understanding is that this is not needed?
I can confirm, having updated my config after reviewing, I’m still getting the same error (this is definitely presented by HA and not the proxy, as I do get the HA logo).
OK - thanks for your help, it seems something else is likely happening here.
Yes, I can hit HA internally by local IP, and hostname, and can also proxy over http, but when I try to proxy over ssl I get the error detailed thrown up by HA (via different browsers, both on laptop and mobile device), and I’m not sure what other logs I can look at within HA (if any) to determine what the problem is.
Thanks - will take a look.
I’m trying to terminate on nginx, and then pass through. Currently, to try to keep it simple, I am only redirecting one site. Name resolution is working internally, but I’ll certainly try these suggestions later today, and see how I get on!
That sounds like something is wrong with the IP Address for the domain. If it wasn’t working externally for the domain, it shouldn’t work internally properly either. Can you hit HA by using the Public IP address?
Can double check by putting the domain here; DNS Lookup Tool - DNS Tools - MxToolbox ; and using the IP Address it spits out. When I did it, the site loaded by HA complained about “Error: invalid client id or redirect uri”, which makes sense due to the fact I don’t have the IP Address in HA.
Internally I’m using hosts files on local system for testing, externally I have updated the A record on my DNS records (and I hit a HA page, just don’t get the login page as expected), so name resolution works for the FQDN from both externally and internally. The routing and name resolution does not appear to be the issue, it would appear to be related to proxying, and/or redirection I think, although given the fact I can proxy http traffixc successfully, I’m somewhat puzzled.
Just noticed that you have Ngnix Access/Error logs setup. Anything in there of use?
Also for shits and giggles, what happens if you copy my Ngnix setup for “location / { }” and add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
under “listen 443”?
@gordonpm - Have tested:
Correct on default_server comment - I’ve rectified this - no difference.
I’ve tried the IP address of HA - no difference
I wouldn’t expect listening on the loopback to work, as I need to listen on the IP which will have inbound traffic. (I tested for the sake of completeness, and no server listening when I attempted the connection).
Thanks for the suggestions, though.
@techwithjake, the add_header element is catered for under this included line:
/etc/letsencrypt/options-ssl-nginx.conf
and currently is:
add_header Strict-Transport-Security “max-age=15768000; includeSubdomains; preload;”;
so I have been running with these options.
There’s nothing in the logging other than connections from my test (and details of the URL & redirect, and a few other connection attempts from the outside world, so nothing of note unfortunately.
I’ve tried myself from different computers, and different networks - I’ll happily PM you the url, in case you can see more than I can - it looks like it must be related to the url re-writes / redirects, or HA itself, but I can’t figure that out at all!!