Like in Oracle PL/SQL via UTL_HTTP.GET_HEADER, Is it possible to pass all header information to access them via psql function, smth like :
current_settings("http_host");
current_settings("http_referer");
I thought there was a github issue about this already, but I can't find it...
Anyway, this is a good idea. We could prefix the name of the variables like request.header.http_referer so that it is similar to how we store JWT claims (e.g. request.jwt.claim.email). One thing is we'll want to avoid making an extra roundtrip to the database to set the variables if we can help it, but it's probably doable.
@begriffs I think you were searching after https://github.com/begriffs/postgrest/pull/664
We could also set IP address of current request. It can be useful to save IPs in the database, for example when you insert a comment on a forum.
@ruslantalpa fyi
@eldadj see #849
until it's merged, you can use the patch.
Looks like it's implemented and released in 0.4.1, should we close the ticket?
@tjunussov maybe you would like to verify?
Closing. Can re-open if anybody runs into a problem with it.
For those (like me) who wonder how to use it, this one works:
current_setting('request.header.user-agent', true)
Most helpful comment
I thought there was a github issue about this already, but I can't find it...
Anyway, this is a good idea. We could prefix the name of the variables like
request.header.http_refererso that it is similar to how we store JWT claims (e.g.request.jwt.claim.email). One thing is we'll want to avoid making an extra roundtrip to the database to set the variables if we can help it, but it's probably doable.