IBX-12127: Fixed valid URLs being marked as invalid by ibexa:check-urls - #809
IBX-12127: Fixed valid URLs being marked as invalid by ibexa:check-urls#809tbialcz wants to merge 2 commits into
Conversation
5b182e3 to
9149e7e
Compare
9149e7e to
3fc0d75
Compare
alongosz
left a comment
There was a problem hiding this comment.
My general remark - if we're revamping this, can we use something more modern than reinvented-wheel-curl?
Like Symfony HTTP client? Or it doesn't make sense here or it's too much work? Just curious.
Remarks to the current solution, which is still a lot of great work 💪
| ignore_certificate: false | ||
| method: HEAD | ||
| fallback_to_get: true | ||
| user_agent: 'Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0' |
There was a problem hiding this comment.
Shouldn't this be something more reflecting reality?
| user_agent: 'Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0' | |
| user_agent: 'Ibexa DXP URL checker' |
Or does Cloudfare treat it as suspicious and it's on purpose like that?
There was a problem hiding this comment.
On purpose — some sites block non-browser UAs (e.g. zillow.com returns 403 instead of 200). The user_agent can be changed if needed.
Thanks! Agreed, HttpClient would be cleaner, and it’s already a dependency. I kept this PR small as a 4.6 bugfix. I’d do the HttpClient rewrite in a follow-up ticket. |
20ed76f to
28f8d47
Compare
| private const METHOD_HEAD = 'HEAD'; | ||
| private const METHOD_GET = 'GET'; | ||
|
|
||
| private const DEFAULT_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0'; |
There was a problem hiding this comment.
this seems to be configured in yaml file, yet we have const here? or those are two different things? cant we at least call const syntax in yaml file?
There was a problem hiding this comment.
right. i removed the duplication
28f8d47 to
57f5a79
Compare
|



Description:
ibexa:check-urlschecked links with a bare cURLHEADrequest without any headers (since the original implementation, EZP-28505). WAFs like Cloudflare block such requests, so working links were marked as invalid.Now the request sends browser-like
User-Agent/Acceptheaders, and a failedHEADis retried once withGET. New optional handler options:method,fallback_to_get,user_agent,headers.Also fixed in the same code: the
httpshandler was readinghttpoptions, and thecurl_multiloop could skip trailing URLs.For QA:
https://www.tiendanimal.es/and to a URL that rejectsHEADrequests (e.g. a localphp -Sserver returning 403 forHEAD), publish.php bin/console ibexa:check-urls— both links are Valid in Link manager (before the fix: Invalid).Documentation:
Yes — document the new
url_checker.handlers.http|httpsoptions:method,fallback_to_get,user_agent,headers.