From 589bfee7de07e9ce8589d862e9e6e003ac0e40d6 Mon Sep 17 00:00:00 2001 From: fro Date: Wed, 29 Oct 2025 05:28:16 -0500 Subject: [PATCH] w --- cfg/ngx/fw.op.fo.conf | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cfg/ngx/fw.op.fo.conf b/cfg/ngx/fw.op.fo.conf index 92737a3..b7ce6b7 100644 --- a/cfg/ngx/fw.op.fo.conf +++ b/cfg/ngx/fw.op.fo.conf @@ -31,7 +31,7 @@ server { # upstream configuration for postgrest (used as reversed proxy) upstream postgrest { - server localhost:3000/rpc/fwd; + server localhost:3000; } # https @@ -69,6 +69,21 @@ server { proxy_pass http://postgrest/rpc/fwd?p_shortcode=$1&p_dbg=true; } +# https://stackoverflow.com/questions/53353572/proxy-pass-cannot-have-uri-part-in-location-given-by-regular-expression + +location ~ ^/([A-Za-z0-9]+) { + rewrite ^/([A-Za-z0-9]+) /rpc/fwd/$1 break; + proxy_pass http://api; + default_type application/json; + proxy_hide_header Content-Location; + add_header Content-Location /rpc/$upstream_http_content_location; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_http_version 1.1; + proxy_method post; + proxy_set_body $args; + proxy_pass http://postgrest; +} + # normal mode: /shortcode location ~ ^/\w+ { #rewrite ^/your_endpoint(.*)$ /your_backend_endpoint?args=$args break;