No Pi-hole block-page on loong urls

I came across an affiliate link whose domain was in the blocklist. It shows a white page instead of the usual blocked page. I tried another long url and it's the same.
Test urls:
http://www.tkqlhce.com/click-749547-10797598?url=http%3A%2F%2Fwww.thesource.ca%2Fen-ca%2Fcomputers-and-tablets%2Fcomputer-accessories%2Fmice%2Fmicrosoft-sculpt-comfort-desktop-keyboard-and-mouse-combo---english%2Fp%2F108013467%23product-details&sid=rfdcb

http://www.longurlmaker.com/go?id=9750u60922ic6enlargedlingering107protractedvb8415lankya0lanky1stretchy1ShrinkURL6x09sgreatRubyURL35181Beam.to4enduring38Metamark5YATUCeShredURLTinyURL0spun%2Bout0EzURLCanURLyShrinkURLah11highB652YATUCb40YepIt9rangyac010uhigh4high21LiteURL40enlarged0Metamarkdeep16010a5elongatedTinyLink1nShredURLenduring2121asNanoRef301URL330Shrinkr6rangylofty0UrlTea09runninglastingGetShortyn0URLHawk002lengthenedrunning6c1prolongedNotLonglUlimitlongish1x0prolonged110rMooURL1DigBig769enduringofar%2Boff0Is.gd0y10Sitelutions0wdrawn%2Bouth0131lingering8ganglingjy409FhURL1201towering105a7lengthenedTraceURL1103remote4012URLHawk4717EasyURLc9StartURL0deep1l1wNotLongqShortlinks34GetShortyx0enduring0prolongedloftySitelutions9X.se83enlarged2ShrtndcontinuedNanoRefb2lengthy2lofty9b8NotLong1m0outstretched9ShredURLlofty8lengthygangling187URLcutsustainedspread%2Bout4enduring1FwdURL21outstretched1elongateelongate1r6Shim80Sitelutions9o140SimURLt14ShortenURLn490EasyURL70417stringygangling0YepIt27far%2Breachinggreat28n8wXilneURLcutaNe1303f4eNe1nU768extensive07longishbstretchingFly2enlargedhdeep0ShortURL712rFly2111prolonged8lengthenedstretchinge7Is.gdgreatprotracted64DigBigk1elongatedtall0dwpsustainedURLCutter015DigBig10loftystretchoprotractedab4230elongatedr83c5CanURLolingeringaShrinkURL8ShoterLinke91tall5lasting493a01211ae0far%2Boff9118m3drawn%2Bout05cShortenURLprotracteda551EzURLRedirxlongishUrlTeaRedirxlengthyo0highf73gdrawn%2Bout0e0wShortlinksURLHawk1r20i1great0NanoRefprolonged30625v9SHurlDoiopvNotLong7db0Is.gdc5deepb0enlarged941B65spread%2Bout50e0loftyXillongish16e0w316aYATUCMooURL17xBeam.to1great410continued40great02extensiveyURLvi1hspread%2Bout5aa2eTightURL01n606URL41continuedk6c2UrlTeakm1GetShortyMyURLMetamark1762aqURLHawkIs.gd8U76wTightURL3ShredURLSHurllzfw1009fShredURLstringyFhURLloftyv0b23o13921lastingSitelutions4078n922drawn%2Bout5continuedDecentURL011fbexpanded9lengthy24running28drawn%2Bout465Shrtnd1ganglingURLcut01URLcutSimURL00A2NNe1a8uexpanded9dfarawayMooURLremote1dlongishvShorl9ulongisha0g1PiURL0s7485stretchingtowering803cr50136084TinyLinkc09stretchingexpande

http://longurlmaker.com/ for some test urls

Ah, good catch. It's looks like it's redirecting to /var/www/html/pihole/index.html instead of index.php, which would suggest the problem lies in the lighttpd.conf file... i'll take a look

This part of the code fails:

$uriExt = pathinfo($uri, PATHINFO_EXTENSION);

The large string length seems break this function.

1 Like

Long urls weren't the problem; it was the period sign. Coincidentally both the urls in the OP have a dot in it : )
The simplest fix would be changing
$uri = escapeshellcmd($_SERVER['REQUEST_URI']);
to
$uri = urldecode($_SERVER['REQUEST_URI']);

escapeshellcmd also causes ? in urls to become \? which breaks search urls.

Test urls

  1. http://www.tkqlhce.com/click-749547-10797598?url=http%3A%2F%2Fwww.thesource.ca%2Fen-ca%2Fcomputers-and-tablets%2Fcomputer-accessories%2Fmice%2Fmicrosoft-sculpt-comfort-desktop-keyboard-and-mouse-combo---english%2Fp%2F108013467%23product-details&sid=rfdcb
  2. http://scorecardresearch.com/düsseldorf?neighbourhood=Lörick

Before
1
tkqlhce.com - white page/1x1 pixel

2

Access to the following site has been blocked: 
scorecardresearch.com/d%C3%BCsseldorf\?neighbourhood=L%C3%B6rick

After
1

Access to the following site has been blocked: 
www.tkqlhce.com/click-749547-10797598?url=http://www.thesource.ca/en-ca/computers-and-tablets/computer-accessories/mice/microsoft-sculpt-comfort-desktop-keyboard-and-mouse-combo---english/p/108013467#product-details&sid=rfdcb

2

Access to the following site has been blocked:
scorecardresearch.com/düsseldorf?neighbourhood=Lörick

To fix this test URL, change
if(in_array($uriExt, $webExt) || empty($uriExt))
to
if(in_array($uriExt, $webExt) || empty($uriExt) || strlen($uriExt) > 16)

Assuming that a file extension is not more than 16 characters (Internet related file extensions list).