Issues Configuring Google Assistant Component (NGINX "POST 403" error's in access.log)

Hi All,

Im a long time lurker around here and on the Discord chat. I’ve been trying for about the last 12 hours to configure Google Assistant with Home Assistant, but i just can get it done for some reason. I have been following the guide at https://www.home-assistant.io/components/google_assistant/ to no avail.

The details of my configuration are below:

Home Assistant is setup on Ubuntu 17.04
SSL Encryption through Lets Encrypt
Nginx Reverse Proxy
Using Home Assistant on my Android Phone (have a Google Mini coming in tomorrow)
Its all on a subdomain with such as https://home.example.com:443

This is the error i get when i go to “Add Device” in the Google Assistant App

64.233.173.18 - - [26/May/2018:14:42:10 +0530] "POST /api/google_assistant?api_password=xxxxx HTTP/1.1" 403 135 "-" "Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)"

On Nginx, i have Fail2ban running, but i have verified that its not the issue.

I would highly appreciate it if someone could please help me navigate this error.

Thank you

PS: I can post additional information, including my server block and nginx conf settings if needed.

Okay, so with lots of help from the kind guys on discord, i’ve managed to get it up and running. I had to add the following as my nginx server config

#Home Assistant Block
server {
  ##BlockedAgent
  #if ($blockedagent) {
  #      return 403;
  #}

  listen 443 ssl;
  server_name home.example.in;
  #return 301 https://$host$request_uri;
  include /etc/nginx/conf.d/*.conf;

    #SSL Configuration
    include /etc/nginx/ssl.conf;

    #Home Assistant
    location / {
    proxy_pass http://192.168.0.12:8123/;
    proxy_set_header Host $host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    #Home Assistant Google Assistant Block
    location /api/google_assistant {
    proxy_pass http://192.168.0.12:8123;
    proxy_set_header Host $host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    #Home Assistant API and Websocket
    location /api/websocket {
    proxy_pass http://192.168.0.12:8123/api/websocket;
    proxy_set_header Host $host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    #Home Assistant Notifications Fix
    location /api/notify.html5/callback {
    if ($http_authorization = "") { return 403; }
    allow all;
    proxy_pass http://192.168.0.12:8123;
    proxy_set_header Host $host;
    proxy_redirect http:// https://;
    }
}
2 Likes