Eran Chetzroni
Eran Chetzroni

Reputation: 1116

Apache - set environment variable from proxy response header

I am proxying apache requests to s3 and I want to rewrite the response header into a new crafted header

this is my configuration:

SetEnvIf x-amz-meta-link "(.*)" DYN_CSS=$0
Header set Link "</static_assets/stylesheets/application-%{DYN_CSS}e.css>; rel=preload; as=stylesheet" env=DYN_CSS

s3 Header is configured to be x-amz-meta-link: css

I am expecting the header in the final response to be

 </static_assets/stylesheets/application-css.css>; rel=preloadas=stylesheet" 

but what I get is (empty var)

</static_assets/stylesheets/application-.css>; 

Upvotes: 1

Views: 2265

Answers (1)

covener
covener

Reputation: 17886

If you are using version 2.4.10+ you can use: I would suggest using the "expr=..." form of the Header directive and using %{resp:x-amz-meta-link} to get the response header value

SetEnvIf only reads request headers, runs before response headers are available, etc.

Upvotes: 4

Related Questions