diff --git a/cfg/ngx/fw.op.fo.conf b/cfg/ngx/fw.op.fo.conf index eca0c12..e06dcf4 100644 --- a/cfg/ngx/fw.op.fo.conf +++ b/cfg/ngx/fw.op.fo.conf @@ -69,13 +69,15 @@ 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; + rewrite ^/([A-Za-z0-9]+) /rpc/fwd?p_shortcode=$1 break; default_type application/json; proxy_hide_header Content-Location; - add_header Content-Location $upstream_http_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; @@ -84,19 +86,19 @@ location ~ ^/([A-Za-z0-9]+) { } # normal mode: /shortcode - location ~ ^/\w+ { - #rewrite ^/your_endpoint(.*)$ /your_backend_endpoint?args=$args break; - #rewrite ^ /your_backend_endpoint?args=$args 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_pass http://postgrest/rpc/fwd?args=$args; -# proxy_pass http://postgrest/rpc/fwd; - proxy_pass http://postgrest; - proxy_set_body $args; - } +# location ~ ^/\w+ { +# #rewrite ^/your_endpoint(.*)$ /your_backend_endpoint?args=$args break; +# #rewrite ^ /your_backend_endpoint?args=$args 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_pass http://postgrest/rpc/fwd?args=$args; +## proxy_pass http://postgrest/rpc/fwd; +# proxy_pass http://postgrest; +# proxy_set_body $args; +# } }