From e03f9dc720cb3d7e0f9edc888667e24d8c929409 Mon Sep 17 00:00:00 2001 From: Aaron Jackson Date: Thu, 18 Apr 2024 09:11:51 +0100 Subject: [PATCH] Replace internal proxy pass with curl --- reverse_proxy/templates/generic.conf.j2 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reverse_proxy/templates/generic.conf.j2 b/reverse_proxy/templates/generic.conf.j2 index f3974b7..99346f6 100644 --- a/reverse_proxy/templates/generic.conf.j2 +++ b/reverse_proxy/templates/generic.conf.j2 @@ -5,7 +5,13 @@ server { # Internal only endpoint for performing a proxy pass to the cran mirror. location /{{ generic_name }}-fetch { internal; - proxy_pass {{ upstream_endpoint }}; + rewrite_by_lua_block { + local uri = ngx.var.uri:gsub("{{ generic_name }}%-fetch", "") + local curl = io.popen("/usr/bin/curl \"{{ upstream_endpoint }}" .. uri .. "\"") + ngx.print(curl:read('*a')) + curl:close(); + ngx.exit(ngx.HTTP_OK) + } } # Define an EICAR endpoint for verifying that the reverse proxy is