diff --git a/cfg/ngx/fw.op.fo.conf b/cfg/ngx/fw.op.fo.conf index b5e9747..8ec2cc8 100644 --- a/cfg/ngx/fw.op.fo.conf +++ b/cfg/ngx/fw.op.fo.conf @@ -53,13 +53,28 @@ server { # postgrest reverse proxy location / { - default_type application/json; - proxy_hide_header Content-Location; - add_header Content-Location /rpc/$upstream_http_content_location; - #proxy_set_header Connection ""; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_http_version 1.1; - proxy_pass http://postgrest/; + error_page 404 = @myownredirect; } + # support /string url style + location ~ ^/(\w+) { + +# # make the response singular +# proxy_set_header Accept 'application/vnd.pgrst.object+json'; + + # assuming an upstream named "postgrest" + proxy_pass http://postgrest/$1?id=eq.$2; + + 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_pass http://postgrest/rpc/fwd?p_shortcode=$1; + +#http://178.156.192.201:3000/rpc/fwd?p_shortcode=ph25&p_dbg=false + + } + + }