[squid-users] Can SQUID change the destination address from ip to hostname?

Matus UHLAR - fantomas uhlar at fantomas.sk
Wed Feb 5 10:01:08 UTC 2025


On 04.02.25 21:22, Foxy Lady wrote:
>I try again asking the ML if
>
>- can Squid change the destination address of a call?
>
>I mean, something like
>
><url_rewrite_command> $destination $Host
>
>original $destination is 104.26.9.59:443
>$Host is the original HTTP Header "Host: xxxxx" alias "api.myip.com:443"
>
>So, a call to
>https://104.26.9.59:443/test
>will become
>https://api.myip.com:443/test

Hello,

I guess that the URL redirector could do that.
http://www.squid-cache.org/Doc/config/url_rewrite_program/

Note that it's extremely unreliable, because IP=>hostname mapping is a wild 
guess, because after client asks for IP address, you don't really know what 
hostname they want. 
So my recommendation is: don't do that.

Note that SOCKS5 protocol supports DNS resolution at server level

>martedì 4 febbraio 2025 06:17, Foxy Lady <Foxy_Lady_1966 at proton.me> ha scritto:
>
>> Hi again.
>> I finally found a tool (great tool, "GO Simple Tunnel") which can serves both HTTP(S)/SOCKS5 Proxy with dns resolution, so chaining it in the middle of Squid, Squid receives the destination in format of "domain.fqdn" and not ip "x.x.x.x",
>>
>> TCP_TUNNEL/200 4118 CONNECT api.myip.com:443 username HIER_DIRECT/104.26.9.59 - "Go-http-client/1.1" [User-Agent: Go-http-client/1.1\r\nProxy-Authorization: Basic bWFyY286dHIwdHQwbGE=\r\nProxy-Connection: keep-alive\r\nHost: api.myip.com:443\r\n] [HTTP/1.1 200 Connection established\r\n\r\n]
>>
>> 👍👍👍
>>
>>
>> Inviato con l'email sicura Proton Mail.
>>
>>
>> lunedì 3 febbraio 2025 22:22, Foxy Lady Foxy_Lady_1966 at proton.me ha scritto:
>>
>> > Sorry, resend the post in txt and correct some parts.
>> > The question is: can i force SQUID to do a reverse dns lookup and maintain the Host Header inside (where's a ptr record is found), also if i can't find a ptr record? SOCKS5 works with 1st level tcp, so send ip addresses, i need some tool, or Squid workaround, which can force a reverse dns. I know, it's quite impossible if a ptr record is not found in dnses, but... i try..
>> >
>> > ----------
>> >
>> > Hi all.
>> > As in subject.
>> > SQUID server has its own dns resolver.
>> >
>> > Can SQUID change the destination address from ip to hostname?
>> >
>> > CLIENT > SQUID > DESTINATION
>> >
>> > 192.168.178.2 TCP_TUNNEL/200 4120 CONNECT api.myip.com:443 - HIER_DIRECT/104.26.8.59
>> >
>> > CLIENT > SOCKS5 PROXY > SQUID > DESTINATION
>> >
>> > 192.168.178.50 TCP_TUNNEL/200 4126 CONNECT 104.26.9.59:443 - HIER_DIRECT/104.26.9.59
>> >
>> > I would need,
>> >
>> > CLIENT > SOCKS5 PROXY > SQUID > DESTINATION
>> >
>> > 192.168.178.50 TCP_TUNNEL/200 4126 CONNECT api.myip.com:443 - HIER_DIRECT/104.26.9.59

-- 
Matus UHLAR - fantomas, uhlar at fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
The early bird may get the worm, but the second mouse gets the cheese.


More information about the squid-users mailing list