Chromecast binding with nginx

Hi there!

I want to use the chromecast binding for my google home,
the problem is that the binding needs to use the Callback URL for playing audio files.
but my openhab page is protected by nginx, and i can’t add a username and password in the binding settings.

I tested with nginx disabled and then its working fine!

changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Unable to load media

this is my nginx file:

server {
listen 80;
server_name xxx.duckdns.org;
return 301 https://$server_name$request_uri;
}

**server {

** listen 443 ssl;**
** server_name xxx.duckdns.org;**

** ssl_certificate /etc/letsencrypt/live/xxx.duckdns.org/fullchain.pem;**
** ssl_certificate_key /etc/letsencrypt/live/xxx.duckdns.org/privkey.pem;**
** add_header Strict-Transport-Security “max-age=31536000”;**

** location / {**
** proxy_pass http://localhost:8080/;**
** proxy_set_header Host $http_host;**
** proxy_set_header X-Real-IP $remote_addr;**
** proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;**
** proxy_set_header X-Forwarded-Proto $scheme;**
** auth_basic “Username and Password Required”;**
** auth_basic_user_file /etc/nginx/.htpasswd;**
** }**

** #### When using Let’s Encrypt Only ####**
** location /.well-known/acme-challenge/ {**
** root /var/www/xxx.duckdns.org;**
** }**
}

callback%20url%20

You need to configure another server in nginx for your local ip, where you don’t use any auth. Since it’s in your lan it shouldn’t be needed. Idag you absolutely want auth you could disable it just for the callback endpoint.

thanks for reply!

yes i want it protected.
how can i disable it for the callback?
so google home doesnt need password for webpage

Here is configuration details how to disable authorization for an endpiont: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
I believe callback goes to /audio/ endpoint, so you should do it public (add “auth_basic off” to this location).

Alternatively you can disable authorization for all the traffic coming from chromecast ip (“allow xx.xx.xx.xx”).