rossbcan
(Rossbcan)
1
Hi;
I am porting home-assistant to run in an iframe under openwrt / luci / nginx (part of openwrt menu system)
Using redirects in nginx, ports and urls are translated properly:
rewrite ^(/static.)$ http://$host:8123$request_uri permanent;
rewrite ^(/frontend_es5.)$ http://$host:8123$request_uri permanent;
rewrite ^(/auth.)$ http://$host:8123$request_uri permanent;
rewrite ^(/api.)$ http://$host:8123$request_uri permanent;
for example:
http://$lan_address/auth is redirected to: http://$lan_address:8123/auth correctly
Problem: while logging in, get Method Not Allowed for this url:
http://$lan_address:8123/api/onboarding/users
I suspect I have run into some sort of security measure as a consequence of redirect.
Anyone have clues?
Thanks;
Bill
BullFrog
(BullFrog)
2
Have you found the solution? I wanna use iframe but openwrt disables it.
rossbcan
(Rossbcan)
3
Nginx:
location ~ ^/(api|auth|static|frontend_es5|frontend_latest)/ {
proxy_pass http://localhost:8123;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#rewrite ^.*$ http://$host:8123$request_uri permanent;
#error_page 405 =200 $uri;
}
location /api/websocket {
proxy_pass http://localhost:8123/api/websocket;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Complex cuz HA does not provide base_url support
General methodology: https://www.rossco.org/modules/TreeList/wrap.php?url=/SecureOffice_Files/HowTo_Nginx.htm#Nginx_Webserver