mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-18 06:41:51 +02:00
Add ingress support with nginx reverse proxy for maintainerr addon
Agent-Logs-Url: https://github.com/alexbelgium/hassio-addons/sessions/14f6643d-9d4f-4c6d-8993-0dbe4404c35d Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
fabf324ee3
commit
703e5a4172
61
maintainerr/rootfs/etc/nginx/servers/ingress.conf
Normal file
61
maintainerr/rootfs/etc/nginx/servers/ingress.conf
Normal file
@@ -0,0 +1,61 @@
|
||||
server {
|
||||
listen %%interface%%:%%port%% default_server;
|
||||
include /etc/nginx/includes/server_params.conf;
|
||||
include /etc/nginx/includes/proxy_params.conf;
|
||||
|
||||
proxy_buffering off;
|
||||
gzip_static off;
|
||||
client_max_body_size 0;
|
||||
|
||||
# Based on https://docs.maintainerr.info/ReverseProxy/#nginx-subdomain
|
||||
location / {
|
||||
set $app '%%ingress_entry%%';
|
||||
|
||||
rewrite ^%%ingress_entry%%/?(.*)$ /$1 break;
|
||||
proxy_pass http://127.0.0.1:6246;
|
||||
|
||||
# WebSocket support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_hide_header X-Powered-By;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Accept-Encoding "";
|
||||
proxy_read_timeout 90;
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header 'Referrer-Policy' 'no-referrer';
|
||||
|
||||
# Redirect location headers
|
||||
absolute_redirect off;
|
||||
proxy_redirect / $app/;
|
||||
|
||||
# Sub filters to rewrite URLs in responses
|
||||
sub_filter_once off;
|
||||
sub_filter_types *;
|
||||
|
||||
# HTML attribute rewrites
|
||||
sub_filter 'href="/"' 'href="%%ingress_entry%%/"';
|
||||
sub_filter 'src="/' 'src="%%ingress_entry%%/';
|
||||
sub_filter 'action="/' 'action="%%ingress_entry%%/';
|
||||
|
||||
# API path rewrites
|
||||
sub_filter '"/api' '"%%ingress_entry%%/api';
|
||||
sub_filter '`/api' '`%%ingress_entry%%/api';
|
||||
sub_filter "'/api" "'%%ingress_entry%%/api";
|
||||
|
||||
# Vite asset rewrites
|
||||
sub_filter '"/assets' '"%%ingress_entry%%/assets';
|
||||
sub_filter '`/assets' '`%%ingress_entry%%/assets';
|
||||
sub_filter "'/assets" "'%%ingress_entry%%/assets";
|
||||
|
||||
# Favicon and static files
|
||||
sub_filter '"/favicon' '"%%ingress_entry%%/favicon';
|
||||
sub_filter '"/logo' '"%%ingress_entry%%/logo';
|
||||
|
||||
# Root path references in JavaScript
|
||||
sub_filter '"\/"' '"%%ingress_entry%%\/"';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user