[squid-users] Insert requested URL to custom header in request

Alex Rousskov rousskov at measurement-factory.com
Wed Jun 21 17:41:51 UTC 2023


On 6/21/23 08:04, Alexeyяр Gruzdov wrote:

> I need to put the requested URL for each user who send 
> request to squid.

I believe you can use logformat %codes in quoted request_header_add 
header field values. For example:

     request_header_add X-Special-Header "%ru"

Be careful with URL value adaptation, encoding, and size though. There 
are important differences between %ru and %>ru codes. See 
squid.conf.documented for details.


HTH,

Alex.



> вт, 20 июн. 2023 г. в 09:35, Alexeyяр Gruzdov <my.shellac at gmail.com 
> <mailto:my.shellac at gmail.com>>:
> 
>     Hello all !
> 
>     I have web app on the server listens on port 8089. This app
>     processes the Get or Post requests, and also checks if there is
>     specific header in request. For example if I will do on the server
>     request like:
> 
>     curl -H “X-my special header:https://example.com
>     <https://example.com>” http://127.0.0.1:8089/send
>     <http://127.0.0.1:8089/send>
> 
>     I will get it working properly I will get answer from example.com
>     <http://example.com> over my application
> 
>     A questions:
> 
>     1. How I can to add the specific header to request with put the
>     value of this header like requested URL ??? Something like “X-my
>     special header: <requested url>
> 
>     2. How I could to put the cache peer host as  originserver option as
>     url ?  Something like
> 
>     http://127.0.0.1:8089/send <http://127.0.0.1:8089/send>
> 
> 
> 
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users



More information about the squid-users mailing list