Skip to content

Commit

Permalink
Replace nginx rewrite rules, add static-paths for static and media qu…
Browse files Browse the repository at this point in the history
…eries (#76)
  • Loading branch information
MrApplejuice authored Nov 6, 2024
1 parent 1489d27 commit f9b4401
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions babybuddy/root/etc/nginx/templates/ingress.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ server {
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;

location /media {
root /app/babybuddy;
}

location /static {
root /app/babybuddy;
}

location / {
allow 172.30.32.2;
deny all;

proxy_pass http://backend;

absolute_redirect off;
proxy_redirect '/' $http_x_ingress_path/;
sub_filter 'href="/' 'href="$http_x_ingress_path/';
sub_filter 'href=/>' 'href="$http_x_ingress_path/">'; # Top left home icon
sub_filter 'action="/' 'action="$http_x_ingress_path/';
sub_filter '<script src="/' '<script src="$http_x_ingress_path/';
sub_filter '<img src="/' '<img src="$http_x_ingress_path/';
sub_filter "top.location.href='" "top.location.href='$http_x_ingress_path";

sub_filter_once off;
{{ if .remoteuser }}
proxy_set_header X-Remote-User '{{ .remoteuser }}';
{{- end }}
Expand Down

0 comments on commit f9b4401

Please sign in to comment.