Anyone using https with ProxyPass and Alexa?

Is anyone using Amazon Echo/Alexa and has a https setup with ProxyPass? I can not get Alexa running with my setup. Before i had direct https send to hass but i wanted https on rest off my server too so i did it with proxyPass. hass is working fine with that, but Alexa is not longer working. On developer.amazon.com under test i get only a default error message.

I am not sure what infos you need from me so please ask and i will answer. :wink:

Here is my vhost config from apache2

<IfModule mod_ssl.c>
        <VirtualHost *:443>
                ServerAdmin [email protected]
                ServerName hass.myDomain.tv

                CustomLog ${APACHE_LOG_DIR}/proxy_hass_access.log combined
                ErrorLog ${APACHE_LOG_DIR}/proxy_hass_error.log
                LogLevel warn

                ProxyRequests off

                SSLEngine on
                SSLProxyEngine On
                SSLCertificateFile      /etc/letsencrypt/live/www.time4.tv/cert2.pem
                SSLCertificateKeyFile   /etc/letsencrypt/live/www.time4.tv/privkey2.pem
                SSLCertificateChainFile /etc/letsencrypt/live/www.time4.tv/chain2.pem

                SSLCACertificatePath    /etc/ssl/certs/

                ProxyRequests off
                ProxyPreserveHost on

                <Location />

                        Order Deny,Allow
                        Allow from all

                        #AuthType Basic
                        #AuthName "You shall not pass"
                        #AuthBasicProvider file
                        #AuthUserFile /etc/apache2/.htpasswd
                        #Require valid-user

                        ProxyPass https://192.168.1.2:8123/ retry=0
                        ProxyPassReverse https://192.168.1.2:8123/
                        
                        ProxyPass ws://192.168.1.2:8123/ retry=0
                        ProxyPassReverse ws://192.168.1.2:8123/

                </Location>
        </VirtualHost>
</IfModule>

And here the hass error i get when trying to get an Alexa answer.

17-02-28 13:53:27 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/aiohttp/web_server.py", line 62, in handle_request
    resp = yield from self._handler(request)
  File "/usr/local/lib/python3.5/site-packages/aiohttp/web.py", line 270, in _handle
    resp = yield from handler(request)
  File "/usr/src/app/homeassistant/components/http/ban.py", line 57, in ban_middleware_handler
    return (yield from handler(request))
  File "/usr/local/lib/python3.5/asyncio/coroutines.py", line 213, in coro
    res = yield from res
  File "/usr/src/app/homeassistant/components/http/__init__.py", line 417, in handle
    result = yield from result
  File "/usr/src/app/homeassistant/components/alexa.py", line 136, in post
    data = yield from request.json()
  File "/usr/local/lib/python3.5/site-packages/aiohttp/web_reqrep.py", line 405, in json
    return loads(body)
  File "/usr/local/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Sorry I canโ€™t really help there as I am using nginx and not apache as WebServer. But maybe it would be okay for you to use a subdomain like โ€œwww.hass.time4.tvโ€ so you would not need a proxy_pass. Don#t know if thatโ€™s an option with your DNS provider tho.

~Cheers

hass.time4.tv is a subdomain of www.time4.tv

If anyone having similar problem, i got it working after updating the proxy pass setting with setting from here

And now i have https for extern, http for local and Alexa is also working over https :slight_smile:

1 Like

Sorry for not getting back to you! I have no idea about apache as I use nginx. But thanks for reporting back on the solution!

~Cheers

Iโ€™m trying to link the Alexa Android App to HA through my NGINX Proxy Manager.
Using the European Client_ID fails with the error message Invalid redirect URI, but if I use the US Client_ID it will connect and link successfully with HA. But it fails to discover any new devices.
I suspect I need some additional Proxy setting to make this work, but I do not know which one.