Created
August 18, 2023 23:24
-
-
Save SafeEval/b7784ce876b536e395f842b9306897b2 to your computer and use it in GitHub Desktop.
Using Apache (httpd), demonstrate returning string literals and environment variables in response headers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using Apache (httpd), demonstrate returning string literals and environment variables in response headers. | |
# | |
# Useful for simple containerized web service PoC. | |
# | |
# docker run -it --rm -p 80:80 -v "$(pwd)/httpd.conf":"/usr/local/apache2/conf/httpd.conf" httpd | |
# | |
# https://httpd.apache.org/docs/current/mod/mod_headers.html | |
# https://serverfault.com/questions/901459/apache-custom-header-with-an-environment-variable | |
# ... snip config file contents .... | |
Header Set X-String-Literal "foobar" | |
# Show the $HOSTNAME env var that is set by default in the httpd container. | |
PassEnv HOSTNAME | |
Header Set X-Env-Hostname %{HOSTNAME}e | |
# If a value was passed in from SSM Parameter Store. | |
PassEnv SSM_PARAMETER_VALUE | |
Header always set X-Env-SSM-Value "%{SSM_PARAMETER_VALUE}e" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment