Skip to content

Recurrent 429 error due to Wikipedia change#14981

Merged
Frenzie merged 1 commit into
koreader:masterfrom
oscargolding:patch-2
Feb 17, 2026
Merged

Recurrent 429 error due to Wikipedia change#14981
Frenzie merged 1 commit into
koreader:masterfrom
oscargolding:patch-2

Conversation

@oscargolding

@oscargolding oscargolding commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

@poire-z raised in #14766 (comment) that the 429 errors started appearing again

I looked into it some more, I am seeing this change from Wikipedia a few weeks ago. Basically koreader requests started returning Varnish as the server in the response header, but we should see Thumbor/7.3.2.

When you go to the linked wiki commit, they added logic to enforce that the user agent is compliant with their robot policy (the koreader user agent didn't have a contact). It seems koreader got sniped by a wiki rate limit again.


This change is Reviewable

@poire-z

poire-z commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for the investigation !
Maybe we could switch to string.format() ?

@poire-z

poire-z commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

started returning Varnish as the server in the response header, but we should see Thumbor/7.3.2.

I see server = "envoy" - but it works.

@oscargolding

Copy link
Copy Markdown
Contributor Author

Thanks for the investigation ! Maybe we could switch to string.format() ?

Used a string template instead :)

@Frenzie Frenzie added this to the 2026.02 milestone Feb 16, 2026
Comment thread frontend/socketutil.lua Outdated
--- Builds a sensible UserAgent that fits Wikipedia's UA policy <https://foundation.wikimedia.org/wiki/Policy:Wikimedia_Foundation_User-Agent_Policy>
local socket_ua = http.USERAGENT
socketutil.USER_AGENT = "KOReader/" .. Version:getShortVersion() .. " (" .. Device.model .. "; " .. jit.os .. "; " .. jit.arch .. ") " .. socket_ua:gsub(" ", "/")
socketutil.USER_AGENT = T("KOReader/%1 (%2; %3; %4; +https://github.com/koreader/koreader) %5",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That + looks out of place?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed - typo

Wikipedia recently started enforcing user agents to contain a contact
link. Without a contact, the request is subject to 429 errors when
requesting images.
@Frenzie Frenzie merged commit d8fc842 into koreader:master Feb 17, 2026
4 checks passed
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Wikipedia recently started enforcing user agents to contain a contact
link. Without a contact, the request is subject to 429 errors when
requesting images.
@poire-z poire-z mentioned this pull request May 16, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants