Re: Header set Link?

Dave Wreski <[email protected]>
Newsgroups gmane.comp.apache.user
Organization Guardian Digital, Inc.
Message-ID <[email protected]>
On 11/16/24 1:52 PM, Dave Wreski wrote:
>>> Header add Link "<https://%{HTTP_HOST}e%{REDIRECT_PDF_CANONICAL_URL}e>; rel=\"canonical\"" env=REDIRECT_PDF_CANONICAL_URL
>>> However, the %{HTTP_HOST} variable doesn't seem to be set.
>> I don't think you can expect that environment variable to be defined.
>> Maybe you want to switch the value argument to use expr= syntax
>> instead so you can use more built-in values.
>
> Do you mean something like this? This doesn't appear to work :-(
>
> SetEnvIf Request_URI "(.+)\.pdf$" PDF_CANONICAL_URL=$1\.pdf
> Header always set Link "<%{HTTP_HOST}e%{REDIRECT_PDF_CANONICAL_URL}e>; 
> rel=\"canonical\"" expr=%{REQUEST_URI} =~ m#(.*)pdf$#"
>
> This is from the example provided in the docs
>
> https://httpd.apache.org/docs/2.4/mod/mod_headers.html
>
This appears to work, but I'd like to explore the expr option, as I'm 
not sure what I've created is reliable and correct.

SetEnvIf Request_URI "(.*)\.pdf$" REQUEST=$1
Header set Link '<https://example.com%{REDIRECT_REQUEST}e.pdf>; 
rel="canonical"' env=REDIRECT_REQUEST
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.