Access ENV variables injected by Apache mod_ssl #2074
-
Hi all, I need to access some of the environment variables injected by an apache webserver in front of PostgREST. https://httpd.apache.org/docs/2.4/mod/mod_ssl.html Can anybody give me a hint how to do it? I want to use client certificate authentication by apache and use the SSL_CLIENT_* variables. Regards |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hey @Markus-, Hm, what's your end goal here? You want to setup HTTPS for PostgREST by using Apache? (We have a section for nginx: https://postgrest.org/en/v9.0/admin.html#https) |
Beta Was this translation helpful? Give feedback.
-
Hi,
as I said, I want to utilize the environment variables Apache adds to the request when authenticating with client certificates.
In PHP I can access those by using the $_SERVER and Flask/Python in request variable.
I would assume in PostgREST there is also a request variable which is probably populated by a proxy?
Regard
Markus
Am 09.12.2021 um 17:56 schrieb Steve Chavez ***@***.***>:
Hey @Markus-<https://github.com/Markus->,
Hm, what's your end goal here? You want to setup HTTPS for PostgREST by using Apache?
(We have a section for nginx: https://postgrest.org/en/v9.0/admin.html#https)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#2074 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACI4VUBJYFTR5CZSSTAN67LUQDNUFANCNFSM5JWNEM3Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
I'm not completely sure but it may work using custom environment variables in the configuration settings https://postgrest.org/en/v9.0/configuration.html#app-settings. You'll need to set the variables there before starting PostgREST, e.g. If the env variables can't be accessed system wide, then another option would be to somehow set those variables in a header and then access them using GUC names: https://postgrest.org/en/latest/api.html?highlight=guc#accessing-request-headers-cookies-and-jwt-claims. I don't know how feasible that option is, though. |
Beta Was this translation helpful? Give feedback.
I'm not completely sure but it may work using custom environment variables in the configuration settings https://postgrest.org/en/v9.0/configuration.html#app-settings. You'll need to set the variables there before starting PostgREST, e.g.
app.settings.ssl_cert_x=$(SSL_CERT_X)
.If the env variables can't be accessed system wide, then another option would be to somehow set those variables in a header and then access them using GUC names: https://postgrest.org/en/latest/api.html?highlight=guc#accessing-request-headers-cookies-and-jwt-claims. I don't know how feasible that option is, though.