From 61eab8bda409e13876a747dfe50012bbb0aac382 Mon Sep 17 00:00:00 2001 From: Seth Grover Date: Thu, 16 Jan 2025 09:07:46 -0700 Subject: [PATCH] fix links for hh redirect download --- nginx/nginx.conf | 23 ++++++----------------- nginx/nginx_readonly.conf | 23 ++++++----------------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index d31c82556..7b66f8c1c 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -180,19 +180,6 @@ http { proxy_set_header Host file-monitor.malcolm.local; } - # extracted file download hedgehog redirect - location ~* ^/hh-extracted-files/([a-zA-Z0-9-\.]+)\b(.*) { - include /etc/nginx/nginx_auth_rt.conf; - include /etc/nginx/nginx_system_resolver.conf; - set $upstream $1:8006; - set $filereq $2; - rewrite ^/hh-extracted-files/([a-zA-Z0-9-\.]+)(.*)$ $filereq break; - proxy_pass https://$upstream; - proxy_ssl_verify off; - proxy_set_header Host $1; - proxy_set_header X-Malcolm-Forward "/hh-extracted-files/$1"; - } - # extracted files from dashboards link (because Dashboards is prepending its own prefix, we have to handle it) location ~* ^/dashboards/app/extracted-files/(.*) { set $forwarded_scheme $scheme; @@ -205,12 +192,14 @@ http { proxy_redirect off; proxy_set_header Host file-monitor.malcolm.local; } - location ~* ^/dashboards/app/hh-extracted-files/([a-zA-Z0-9-\.]+)\b(.*) { + + # extracted file download hedgehog redirect + location ~* ^/(dashboards/app/)?hh-extracted-files/([a-zA-Z0-9-\.]+)\b(.*) { include /etc/nginx/nginx_auth_rt.conf; include /etc/nginx/nginx_system_resolver.conf; - set $upstream $1:8006; - set $filereq $2; - rewrite ^/dashboards/app/hh-extracted-files/([a-zA-Z0-9-\.]+)(.*)$ $filereq break; + set $upstream $2:8006; + set $filereq $3; + rewrite ^/(dashboards/app/)?hh-extracted-files/([a-zA-Z0-9-\.]+)(.*)$ $filereq break; proxy_pass https://$upstream; proxy_ssl_verify off; proxy_set_header Host $1; diff --git a/nginx/nginx_readonly.conf b/nginx/nginx_readonly.conf index d642d55ce..3b490ac73 100644 --- a/nginx/nginx_readonly.conf +++ b/nginx/nginx_readonly.conf @@ -141,19 +141,6 @@ http { proxy_set_header Host file-monitor.malcolm.local; } - # extracted file download hedgehog redirect - location ~* ^/hh-extracted-files/([a-zA-Z0-9-\.]+)\b(.*) { - include /etc/nginx/nginx_system_resolver.conf; - set $upstream $1:8006; - set $filereq $2; - # TODO: check, do i need is_args/args here? - rewrite ^/hh-extracted-files/([a-zA-Z0-9-\.]+)(.*)$ $filereq break; - proxy_pass https://$upstream; - proxy_ssl_verify off; - proxy_set_header Host $1; - proxy_set_header X-Malcolm-Forward "/hh-extracted-files/$1"; - } - # extracted files from dashboards link (because Dashboards is prepending its own prefix, we have to handle it) location ~* ^/dashboards/app/extracted-files/(.*) { set $forwarded_scheme $scheme; @@ -166,12 +153,14 @@ http { proxy_redirect off; proxy_set_header Host file-monitor.malcolm.local; } - location ~* ^/dashboards/app/hh-extracted-files/([a-zA-Z0-9-\.]+)\b(.*) { + + # extracted file download hedgehog redirect + location ~* ^/(dashboards/app/)?hh-extracted-files/([a-zA-Z0-9-\.]+)\b(.*) { include /etc/nginx/nginx_auth_rt.conf; include /etc/nginx/nginx_system_resolver.conf; - set $upstream $1:8006; - set $filereq $2; - rewrite ^/dashboards/app/hh-extracted-files/([a-zA-Z0-9-\.]+)(.*)$ $filereq break; + set $upstream $2:8006; + set $filereq $3; + rewrite ^/(dashboards/app/)?hh-extracted-files/([a-zA-Z0-9-\.]+)(.*)$ $filereq break; proxy_pass https://$upstream; proxy_ssl_verify off; proxy_set_header Host $1;