sebbacon / home-automation

5 stars 0 forks source link

Set up nginx as a proxy #5

Closed sebbacon closed 6 years ago

sebbacon commented 6 years ago

So we can:

sebbacon commented 6 years ago

Progress:

sebbacon commented 6 years ago

Configured certificate over DNS:

certbot certonly --manual --preferred-challenges dns

Set up two nginx servers on ports 443 and 444 for openhab and grafana respectively, forwarded ports 81 and 92 to these. Turned off auth within openhab and grafana and replaced with basic auth in nginx.

Had to override basic auth header when proxying to grafana:

https://github.com/grafana/grafana/issues/8314#issuecomment-320197195

sebbacon commented 6 years ago

There's a small issue that going to the root https://openhab.baconconsulting.co.uk:81/ redirects to http://openhab.baconconsulting.co.uk/start/index. I can't connect via the mobile app so I wonder if that's related.

Tracing the app, it calls:

GET /rest/bindings

sebbacon commented 6 years ago

Fixed this by having the router forward to the same ports that nginx was listening on (i.e. 81-82).