I'm currently using the Grafana module Powerwall-Dashboard to show local stats for my Tesla Power wall.
It uses an embedded iFrame which is over http, which seems to have this issue:
The problem does have a solution but I am unsure how to do this with Traefik. The solution the author wrote was for lighthttpd:
$SERVER["socket"] == "0.0.0.0:8675" { ssl.engine = "enable" ssl.cipher-list = "aRSA+HIGH !3DES +kEDH +kRSA !kSRP !kPSK" ssl.pemfile = "/mnt/kd/ssl/webinterface.pem" ssl.ca-file = "/mnt/kd/ssl/https_ca_chain.pem" server.document-root = "" proxy.server += ( "" => (( "host" => "192.168.29.48", "port" => "8675" )) ) }
So now in my webpage, instead of pointing the iFrame at the pyPowerwall host, port 8675, I point it at my lighttpd host (as https), same port number, which is then proxy'd over to the non-secure pyPowerwall host. Works like a charm.
Replace the pem and ca-files to point at your own certificates, and the IP address of the pyPowerwall server to point at your server address.
Now for accessing weather data at port 8676 I ran into another problem which is that javascript / http requests (which I use to get the weather JSON data) to a different host may also get blocked by the browser with an Access-Control-Allow-Origin error. Again the web server has to be configured to permit that.
Again lighttpd has a config setting for that...
$SERVER["socket"] == "0.0.0.0:8676" { setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" ) ssl.engine = "enable" ssl.cipher-list = "aRSA+HIGH !3DES +kEDH +kRSA !kSRP !kPSK" ssl.pemfile = "/mnt/kd/ssl/webinterface.pem" ssl.ca-file = "/mnt/kd/ssl/https_ca_chain.pem" server.document-root = "" proxy.server += ( "" => (( "host" => "192.168.29.48", "port" => "8676" )) ) }
And now my web page can retrieve weather data as well.
Just thought I would post this in case others attempt to do the same and run into similar problems.
My docker-compose:
services:
grafana:
image: grafana/grafana:9.1.2-ubuntu
container_name: grafana
hostname: grafana
restart: always
user: "1003:1003"
volumes:
- type: bind
source: /mnt/container_data/grafana
target: /var/lib/grafana
ports:
- target: 9000
published: 9000
# host_ip: 127.0.0.1
mode: host
env_file:
- grafana.env
depends_on:
- influxdb
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.tls=true"
- "traefik.http.routers.grafana.tls.certresolver=stepca"
- "traefik.http.routers.grafana.rule=Host(`grafana.$MY_DOMAIN`)"
- "traefik.http.routers.grafana.entrypoints=websecure"
- "traefik.http.services.grafana.loadbalancer.server.port=9000"
pypowerwall:
image: jasonacox/pypowerwall:latest
container_name: pypowerwall
hostname: pypowerwall
restart: always
ports:
- target: 8675
published: 8675
# host_ip: 127.0.0.1
mode: host
env_file:
- pypowerwall.env
weather411:
image: jasonacox/weather411:latest
container_name: weather411
hostname: weather411
restart: always
user: "1000:1000"
volumes:
- type: bind
source: ./weather
target: /var/lib/weather
read_only: true
ports:
- target: 8676
published: 8676
host_ip: 127.0.0.1
mode: host
environment:
- WEATHERCONF=/var/lib/weather/weather411.conf
depends_on:
- influxdb
networks:
default:
external: true
name: ${DEFAULT_NETWORK}