I have a custom board with multiple I/Os that I have written a custom_component for. Currently, I am using an Apache virtual host file to “inject” the Authorization header in so that HA receives status changes of the board (board does a GET request to http://HA_IP:8443:
<VirtualHost *:8443>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests On
ProxyPreserveHost On
ProxyPass / http://HA_IP:8123/
ProxyPassReverse / http://HA_IP:8123/
Header add Authorization "Bearer MYLONGLIVEDTOKEN"
RequestHeader set Authorization "Bearer MYLONGLIVEDTOKEN"
ServerName localhost
</VirtualHost>
I am now migrating everything to Docker and thought it would be better to use an Nginx container rather than Apache. I’m trying to emulate the above with Nginx, but cannot find the similar line to “RequestHeader set Authorization”. Can anyone help? This is what I have so for, not working naturally…
events {
}
http {
server {
listen 8443;
listen [::]:8443;
location / {
proxy_pass http://HA_IP:8123;
proxy_set_header Authorization "Bearer MYLONGLIVEDTOKEN";
}
}
}