This commit is contained in:
fro
2025-10-29 05:59:58 -05:00
parent 94290cbb7f
commit 0ad7172061

View File

@@ -59,7 +59,7 @@ server {
error_page 404 = @myownredirect; error_page 404 = @myownredirect;
} }
# debug url: /dbg/string # /dbg/shortcode | debug mode
location ~ ^/dbg/(\w+) { location ~ ^/dbg/(\w+) {
default_type application/json; default_type application/json;
proxy_hide_header Content-Location; proxy_hide_header Content-Location;
@@ -69,22 +69,20 @@ server {
proxy_pass http://postgrest/rpc/fwd?p_shortcode=$1&p_dbg=true; proxy_pass http://postgrest/rpc/fwd?p_shortcode=$1&p_dbg=true;
} }
# /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 # 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;
location ~ ^/([A-Za-z0-9]+) { default_type application/json;
# rewrite ^/([A-Za-z0-9]+) /rpc/fwd?p_shortcode=$1&p_dbg=true break; proxy_hide_header Content-Location;
rewrite ^/([A-Za-z0-9]+) /rpc/fwd break; add_header Content-Location /rpc/$upstream_http_content_location;
default_type application/json; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header Content-Location; proxy_http_version 1.1;
add_header Content-Location /rpc/$upstream_http_content_location; 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"
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; set $query_string $args;
proxy_http_version 1.1; proxy_set_body $query_string;
proxy_method POST; proxy_pass http://postgrest;
proxy_set_body $args; }
proxy_pass http://postgrest;
}
# normal mode: /shortcode # normal mode: /shortcode
# location ~ ^/\w+ { # location ~ ^/\w+ {