mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-07 16:15:55 +02:00
ingress addition
This commit is contained in:
15
photoprism/rootfs/etc/cont-init.d/32-nginx_ingress.sh
Normal file
15
photoprism/rootfs/etc/cont-init.d/32-nginx_ingress.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
#################
|
||||
# NGINX SETTING #
|
||||
#################
|
||||
declare ingress_interface
|
||||
declare ingress_port
|
||||
|
||||
ingress_port=$(bashio::addon.ingress_port)
|
||||
ingress_interface=$(bashio::addon.ip_address)
|
||||
ingress_entry=$(bashio::addon.ingress_entry)
|
||||
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf
|
||||
@@ -84,6 +84,8 @@ bashio::log.info "Please wait 1 or 2 minutes to allow the server to load"
|
||||
bashio::log.info 'Default username : admin, default password: "please_change_password"'
|
||||
|
||||
cd /
|
||||
./scripts/entrypoint.sh photoprism start & bashio::log.info "App launched..."
|
||||
./scripts/entrypoint.sh photoprism start & bashio::log.info "Starting..."
|
||||
|
||||
bashio::net.wait_for 2341 localhost 900 bashio::log.info "App launched..."
|
||||
|
||||
exec nginx
|
||||
|
||||
49
photoprism/rootfs/etc/nginx/servers/ingress.conf
Normal file
49
photoprism/rootfs/etc/nginx/servers/ingress.conf
Normal file
@@ -0,0 +1,49 @@
|
||||
server {
|
||||
listen %%interface%%:%%port%% default_server;
|
||||
include /etc/nginx/includes/server_params.conf;
|
||||
include /etc/nginx/includes/proxy_params.conf;
|
||||
client_max_body_size 0;
|
||||
server_name photoprism.*;
|
||||
|
||||
location / {
|
||||
|
||||
proxy_pass http://127.0.0.1:2341;
|
||||
|
||||
# Websockets
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
# Rewrite url
|
||||
sub_filter_types *;
|
||||
sub_filter "/manifest.json" "%%ingress_entry%%/manifest.json";
|
||||
sub_filter "/browse" "%%ingress_entry%%/browse";
|
||||
sub_filter "/static" "%%ingress_entry%%/static";
|
||||
sub_filter "/auth" "%%ingress_entry%%/auth";
|
||||
sub_filter "/api" "%%ingress_entry%%/api";
|
||||
sub_filter "/albums" "%%ingress_entry%%/albums";
|
||||
sub_filter "/videos" "%%ingress_entry%%/videos";
|
||||
sub_filter "/people" "%%ingress_entry%%/people";
|
||||
sub_filter "/favorites" "%%ingress_entry%%/favorites";
|
||||
sub_filter "/moments" "%%ingress_entry%%/moments";
|
||||
sub_filter "/calendar" "%%ingress_entry%%/calendar";
|
||||
sub_filter "/places" "%%ingress_entry%%/places";
|
||||
sub_filter "/labels" "%%ingress_entry%%/labels";
|
||||
sub_filter "/folders" "%%ingress_entry%%/folders";
|
||||
sub_filter "/private" "%%ingress_entry%%/private";
|
||||
sub_filter "/library" "%%ingress_entry%%/library";
|
||||
sub_filter "/settings" "%%ingress_entry%%/settings";
|
||||
sub_filter_once off;
|
||||
proxy_buffering off;
|
||||
proxy_read_timeout 30;
|
||||
|
||||
# Allow frames
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_hide_header "Content-Security-Policy";
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
proxy_set_header Accept-Encoding "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user