Traccar and Squid Proxy

kzo812 months ago

Hi,
I would like to use squid proxy with Traccar and OpenStreetMap to cache the tiles for LAN users.
This is the SQUID configuration:

# port
http_port 443 act-as-origin
# parent cache
cache_peer tile.openstreetmap.org parent 443 0 no-query no-digest originserver name=osmTiles forceddomain=tile.openstreetmap.org

# lan segment
acl lab src 192.168.50.0/24
http_access allow lab
http_access deny all

# memory configuration
cache_mem 1024 MB
maximum_object_size_in_memory 512 KB
cache_dir aufs /var/spool/squid 1024 16 256
refresh_pattern -i \.(gif|png|jpg|jpeg|ico)$ 3600 90% 302400

# log time format
logformat combined %>a %[ui %[un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
logformat custom %tl.%03tu %>a %Ss/%03>Hs %<st %rm %ru %[un %Sh/%<a %mt
access_log daemon:/var/log/squid/access.log combined

And when I insert this to the Traccar's custom map URL, it doesnt pull the tiles anymore:

192.168.50.101:3128 https://a.tile.openstreetmap.org/{z}/{x}/{y}.png

This test works properly when I pull manually a tile from the squid:

curl -I 192.168.50.101:3128 https://www.openstreetmap.org/#map=8/47.184/19.509

Do you have any idea what I am missing?

Anton Tananaev2 months ago

I'm confused why you're testing completely different tile URL.

kzo812 months ago

ok, I changed:

curl -I 192.168.50.101:3128 https://a.tile.openstreetmap.org/9/286/187.png

It is successful.
So do you have any idea how to get Traccar to use my Squid Proxy?

Anton Tananaev2 months ago

What's the error? Provide a screenshot.

kzo812 months ago

LOL. The error is that the map is empty.

Anton Tananaev2 months ago

I'm obviously talking about the error you see in the browser developer tools.

kzo812 months ago

The error is: Web Socket Connection Error

This is what I have inserted into Traccar's custom map field:

192.168.50.101:3128 https://a.tile.openstreetmap.org/{z}/{x}/{y}.png

if I test it like this:

curl -I 192.168.50.101:3128 https://a.tile.openstreetmap.org/9/286/187.png

It works, I downloaded that tile png through the Squid Proxy Server

Anton Tananaev2 months ago

That's not a URL, so it obviously won't work.

kzo812 months ago

ok, anyway, is there a way to convince Traccar to pull the tiles from my local proxy?
I installed the 6.0 version Traccar on my laboratory laptop, and I see that a lot of map servers are in red colors.
I would like to use OpenStreetMap but cached with a help of my Squid server

Anton Tananaev2 months ago

If you can configure it to be a proper HTTP proxy, then it should work.

kzo812 months ago

Is there a directive in the Traccar xml config file, that is used for a properly configured HTTP Proxy? Thanks.

Anton Tananaev2 months ago

What? It doesn't require any configuration in Traccar.

kzo812 months ago

ok, thanks.

kzo812 months ago

Then I think the proxy settings should be set in the OS level, this way Traccar wont know about it.