0

Basically I want to do the opposite of this question: Sending machine hostname as a header in Apache

A header in the request (say "OIDC_CLAIM_nickname") contains a hostname. I want to proxy the request to hostname.somedomain.com

How do I do this?

EDIT:

This is what I tried:

LogFormat "%{OIDC_CLAIM_nickname}i"

RewriteEngine on
RewriteMap lowercase int:tolower

RewriteRule ^ - [E=NICK_NAME:${lowercase:%{OIDC_CLAIM_nickname}}]

ProxyPassInterpolateEnv On

<Location "/">
   AuthType openid-connect
   Require valid-user
   ProxyPass http://${NICK_NAME}.somedomain.com/ interpolate
   ProxyPassReverse http://${NICK_NAME}.somedomain.com/ interpolate
</Location>

But it doesn't work. In the access log I see the OIDC_CLAIM_nickname header value but in the error log I see Apache is trying to resolve ".somedomain.com", i.e. the variable name is empty.

Stefan D
  • 103
  • 3

1 Answers1

0

You need to use %{HTTP:OIDC_CLAIM_nickname} to reference the HTTP header, not just %{OIDC_CLAIM_nickname}.

And you do not need to use lowercase, host names are case insensitive.

Unbeliever
  • 2,336
  • 1
  • 10
  • 19