On Wed, Oct 23, 2019 at 12:41 PM Martin T <m4rtn...@gmail.com> wrote:
>
> Hi,
>
> I have a following Apache virtual host configuration where custom
> call_Google_MP_API script receives the IP address and HTTP User-Agent
> string as standard input if https://www.example.com/doc.pdf is
> downloaded:
>
> <IfModule ssl_module>
>     <VirtualHost *:443>
>         /* configuration removed for brevity */
>         SetEnvIf Request_URI "^/doc\.pdf$" pdfdoc
>         LogFormat "%h %{User-agent}i" ga
>         CustomLog "|/usr/local/bin/call_Google_MP_API" ga env=pdfdoc
>     </VirtualHost>
> </IfModule>
>
> As my web server had setenvif_module and log_config_module already
> loaded, then I used SetEnvIf directive to set the "pdfdoc" internal
> variable when doc.pdf is downloaded, LogFormat directive to set the
> nickname "ga" for specific log format and finally CustomLog directive
> to pipe this custom log format to call_Google_MP_API script if
> "pdfdoc" variable is set, i.e https://www.example.com/doc.pdf URL is
> accessed.
>
> While this seems to work fine, then is this the correct/optimal way to
> accomplish this?

It is a little weird but pretty neat.

A RewriteMap of type prg: is maybe a little better.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to