From 0ad7172061791d48bae33bf0e5902a08f474a0a9 Mon Sep 17 00:00:00 2001 From: fro Date: Wed, 29 Oct 2025 05:59:58 -0500 Subject: [PATCH] w --- cfg/ngx/fw.op.fo.conf | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/cfg/ngx/fw.op.fo.conf b/cfg/ngx/fw.op.fo.conf index 478d814..d9c7d31 100644 --- a/cfg/ngx/fw.op.fo.conf +++ b/cfg/ngx/fw.op.fo.conf @@ -59,7 +59,7 @@ server { error_page 404 = @myownredirect; } - # debug url: /dbg/string + # /dbg/shortcode | debug mode location ~ ^/dbg/(\w+) { default_type application/json; proxy_hide_header Content-Location; @@ -69,22 +69,20 @@ 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?p_shortcode=$1&p_dbg=true break; - rewrite ^/([A-Za-z0-9]+) /rpc/fwd break; - 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; -} + # /shortcode | normal mode + location ~ ^/([A-Za-z0-9]+) { + # https://stackoverflow.com/questions/53353572/proxy-pass-cannot-have-uri-part-in-location-given-by-regular-expression + rewrite ^/([A-Za-z0-9]+) /rpc/fwd break; + 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; # note, that if writing 'post' (lowercase) instead of 'POST' (uppercase), that will lead to the postgrest error "cannot use the post method on rpc" + set $query_string $args; + proxy_set_body $query_string; + proxy_pass http://postgrest; + } # normal mode: /shortcode # location ~ ^/\w+ {