Use localhost for injections

ag_bug_finder

Beta Tester
In Adguard Advanced Settings, there is a setting where the default is set to "Use localhost for injections".

To achieve faster browsing/less slow downs, should this option be ticked or unticked?

Please give all pros and cons to both the option ticked and unticked.
 
T

The Commissioner

Guest
There are only cons no pros :p
If you disable localhost for injections, AdGuard will use remote host for injections which is what they were using in v5 and the localhost injections was supposed to solve it.
No matter if you wish or no, no matter if the page requires it or no. It is embedded.

For me it has been questionable ever since.
Strike 1: - It doesnot show in the filtering log.
Strike 2: - You can't block it.
Strike 3: - It is injected even on pages which don't require it.

Chances are if you tell somebody even one of those reasons the trust factor would come into question, I gave you three reasons.

Now understand what it does to the performance:-
Suppose on a page with total 10 requests - 9 are legitimate page request and 1 is ad/tracker request.

Adblocker like uBlock will block that ad/tracker request and what you have is effectively 9 requests loading.
Now Adguard will also block that ad/tracker but it will also inject this localhost script, so effectively loading 10 requests(9+ local.adguard.com script) in total(thus comparitively slower).
What gets more interesting is, if the page has no ads even then this script is loaded so effectively, increasing the time taken to load the page with an adblocker than it would have taken without one.

This was just one example, they also inject the Assistant and Popup blocker in same way. (So, that's 3 extra requests per page). Ofcourse it would be slow.
 

vasily_bagirov

Administrator
Staff member
Administrator
Sorry for not replying, I'll ask Windows developer to post an answer here (or will post their reply for them).
 

vasily_bagirov

Administrator
Staff member
Administrator
@ag_bug_finder The Comissioner explained it very well. As for "pros", really, the only case when it would be justified to use remote host over localhost is some compatibility problem. This is not a coincidence the setting is hidden inside the "Advanced settings".

EDIT: another corner case when it can be potentially preferrable: when this option is enabled, AG will not only process TCP connections, but also TCP connection requests, which can rarely lead to browser "freezes", depending on your computer configuration and installed apps. This really doesn't happen almost ever, so don't disable this option unless something is wrong and you have grounds to believe that using localhost is causing it.
 
Last edited:

ag_bug_finder

Beta Tester
I'm sorry, but I'm more confused now than ever.

Vasily, you seem to think that The Commissioner is saying that ticking/enabling the "Use localhost for injections" is a good thing.

However, what I understood from The Commissioner's post was that he doesn't like the option "Use localhost for injections" and especially doesn't like that it is enabled by default. He thinks its slower, as well as those three strike points against using "Use localhost for injections".

So can you both please tell me if you guys think "Use localhost for injections" is a good thing or not to use?
Just say if its good or bad for starters.
 

vasily_bagirov

Administrator
Staff member
Administrator
@ag_bug_finder I doubt Comissioner will post anything here, as he asked to delete his account not so long ago.

Anyway, I was talking to a Windows dev today (@kavabanga ) and he said that enabling "Use localhost for injections" is better almost always (mostly because of the connection speed).

I am re-reading Commisioner's answer and it appears to me that he dislikes not using this option:

If you disable localhost for injections, AdGuard will use remote host for injections which is what they were using in v5 and the localhost injections was supposed to solve it.
No matter if you wish or no, no matter if the page requires it or no. It is embedded.

For me it has been questionable ever since.
 

ag_bug_finder

Beta Tester
@ag_bug_finder I doubt Comissioner will post anything here, as he asked to delete his account not so long ago.

Anyway, I was talking to a Windows dev today (@kavabanga ) and he said that enabling "Use localhost for injections" is better almost always (mostly because of the connection speed).

I am re-reading Commisioner's answer and it appears to me that he dislikes not using this option:
Sorry, but I still feel that his comments meant he was NOT happy with localhost injections:
Now understand what it does to the performance:-
Suppose on a page with total 10 requests - 9 are legitimate page request and 1 is ad/tracker request.

Adblocker like uBlock will block that ad/tracker request and what you have is effectively 9 requests loading.
Now Adguard will also block that ad/tracker but it will also inject this localhost script, so effectively loading 10 requests(9+ local.adguard.com script) in total(thus comparitively slower).
What gets more interesting is, if the page has no ads even then this script is loaded so effectively, increasing the time taken to load the page with an adblocker than it would have taken without one.

This was just one example, they also inject the Assistant and Popup blocker in same way. (So, that's 3 extra requests per page). Ofcourse it would be slow.
 

kavabanga

Administrator
Staff member
Administrator
@ag_bug_finder , hello! If we want to talk in brief, so using the option "localhost" is preferable. In this case, AdGuard handles and redirects all the "service" request (for script injections) to the local "injections" server on the driver side, avoiding processing them as a usual request. If this option is disabled, AG processes such request in a common way, so the whole process of filtering can be slower. In some rare cases (e.g. when you use some "particular" antiviruses or browser), using this option can lead to hanging, but again, this is rather an exception, and we strictly recommend disable this option only in such cases (which in turn can be detected experimentally for example). Finally, in both cases, AG uses additional "service" requests, so roughly speaking the differences is in how AG handles them.
 

TheTooolguy

New Member
Well, from personal experience ...

local.adguard.com always point's to 194.177.23.34 ...

It will only point to the localhost if you add this to the hosts file of your machine:

127.0.0.1 local.adguard.com

The advanced setting in AdGuard does not work ('Use localhost for injections') at all !

Proof:
adg_proof.jpg

Regards,
TheToolGuy
 

avatar

Administrator
Staff member
Administrator
local.adguard.com always point's to 194.177.23.34 ...

It will only point to the localhost if you add this to the hosts file of your machine:

127.0.0.1 local.adguard.com
You should not do it.

Here's how the "use local injections" work:

1. AG intercepts connections to 194.177.23.34
2. Re-routes them internally and prevents a remote connection creation
3. Responds locally

Using 127.0.0.1 is not possible because browsers won't let you create an HTTPS connection to the localhost.
 

TheTooolguy

New Member
You should not do it.

Here's how the "use local injections" work:

1. AG intercepts connections to 194.177.23.34
2. Re-routes them internally and prevents a remote connection creation
3. Responds locally

Using 127.0.0.1 is not possible because browsers won't let you create an HTTPS connection to the localhost.
Hmmmm ....

Why does it speed up my browsing experience tremendously when I add it to my hosts-file ???
My browser(s) NEVER hangs/timeout anymore when doing this ... else it waits for at least 5 minutes on response from local.adguard.com before continueing (but most of the time crashing the browser tab-session) 8 out of 10 times it waits ... not funny ...
 

avatar

Administrator
Staff member
Administrator
My browser(s) NEVER hangs/timeout anymore when doing this ... else it waits for at least 5 minutes on response from local.adguard.com before continueing (but most of the time crashing the browser tab-session) 8 out of 10 times it waits ... not funny ...
This sounds like a compatibility issue to me. What AV/browser do you use?
 

TheTooolguy

New Member
This sounds like a compatibility issue to me. What AV/browser do you use?
Google Chrome (99.999 %) and Kasperski Antivirus ...
Not using ANY proxy, all connections are marked as direct connections.
Interrnet connection speed: 400mbit download / 40mbit upload.
 
Last edited:

avatar

Administrator
Staff member
Administrator
I've never heard about such an issue with Kaspersky (it can be problematic sometimes, but not in this way).
What about unchecking "use local injections", does it make things faster?
 

avatar

Administrator
Staff member
Administrator
I'd like to clarify that unchecking "use local injections" does not make things "remote" :)

The difference is the stage when AG intercepts connection and with this option unchecked, AG does it later (in terms of connection state).
 
Top