awslabs/aws-sigv4-proxy

Host Head as Env Var

tigerpeng2001 opened this issue · 3 comments

Hello,

Is it possible to optionally pass the host header as an environmental variable into the container, so no host head is needed from the command line, the normal browser can be used, and some client applications can be configured easily?

Tiger

Was having the same question and took a look at the code.
Looks like it's possible to pass --host as an parameter to override the host to proxy to.

https://github.com/awslabs/aws-sigv4-proxy/blob/master/cmd/aws-sigv4-proxy/main.go#L45

@tigerpeng2001 can you elaborate further? Seems like --host does not work for and you would like the proxy to grab the value from some environment variable?

the normal browser can be used, and some client applications can be configured easily

Can you elaborate more on this case? I am not sure I understand why --host doesn't work for your use case. Thanks in advance :-)

I had initially assumed that I needed this feature as well, because my host value comes from an environmental variable. If you are running it in Kubernetes, you can inject environmental variables into the command arguments with the $() syntax:

image: public.ecr.aws/aws-observability/aws-sigv4-proxy:1.6
args:
  - --name=es
  - --region=$(AWS_REGION)
  - --host=$(ELASTICSEARCH_URL)
  - --port=:9200

This worked for my use case.