Page MenuHomePhabricator

Replacing url links of static assets (js ,css ) hosted on external servers to proxy links
Closed, ResolvedPublic

Description

Wikipedia have a policy to avoid files hosted outside its server.
https://wikitech.wikimedia.org/wiki/Help:Toolforge/Web#External_assets
So as to comply to that we need to replace all link of static files hosted outside Wikimedia servers with the proxy link.
Ex.

https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.css

to

https://tools-static.wmflabs.org/cdnjs/ajax/libs/select2/4.0.7/css/select2.css

The earlier task was:

I have observed using the browser developer tools the we are using some js and css files hosted on wmflabs such as
https://tools-static.wmflabs.org/cdnjs/ajax/libs/select2/4.0.7/css/select2.css
, but it is taking approximately ten times more ping time for loading than its identical file hosted at cdnjs
https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.css
. I thnk we should replace all such identical files, this will affect the loading time of web page significantly.

Event Timeline

Sanyam.wikime updated the task description. (Show Details)
Sanyam.wikime updated the task description. (Show Details)
Sanyam.wikime moved this task from Backlog to In progress on the ISA board.Mar 4 2020, 1:01 PM

@Sanyam.wikime, seems like there're 4 cases of that, all in isa/templates/main/layout.html, fyi.

@Gabrielchihonglee I found six of those in layout.html (2 *.css and 4 *.js)

@Sanyam.wikime , ahhhh, you should change "Task-Id" in the commit message to "Bug" next time :)

Change 576824 had a related patch set uploaded (by Sanyam.wikime; owner: Sanyam.wikime):
[labs/tools/Isa@master] Replacing standard js and css libraries hosted on wmflabs with identical libraries hosted on cdnjs

https://gerrit.wikimedia.org/r/576824

Also, I think that this shouldn't be done. As we are supposed to load scripts and stylesheets through the Wikimedia cdnjs tool, it's "to ensure participants in the Cloud Services/Toolforge environment can use libraries from cdnjs.com without sacrificing the privacy called for by the Wikimedia Terms of Service".

So instead of replacing wikimedia cdnjs links to cloudflare or other providers ones, we should do the opposite.

However, we can consider adding some caching for out cdnjs proxy for better response times. @Bstorm thoughts?

Eugene233 updated the task description. (Show Details)Mar 5 2020, 8:42 AM

Thanks @Gabrielchihonglee for mentioning the issue with the policy. I didn't know before about that, I viewed some other projects on Wikimedia using cdnjs.com and other external services for static part, so I suggested the same for ISA. But as stated by you, this doesn't comply with Wikimedia's policies, so should I do the opposite of that ?
Should I rename the task and description also to depict the opposite also ?

Thanks @zhuyifei1999 for reviewing the patch. I will consider the appropriate changes.

But as stated by you, this doesn't comply with Wikimedia's policies, so should I do the opposite of that ?

We would appreciate that. Thanks.

Sanyam.wikime renamed this task from Replacing standard js and css libraries with identical libraries hosted on cdnjs to Replacing static assets (js ,css ) hosted on external servers to hosted on Wikimedia.Mar 5 2020, 12:39 PM
Sanyam.wikime renamed this task from Replacing static assets (js ,css ) hosted on external servers to hosted on Wikimedia to Replacing url links of static assets (js ,css ) hosted on external servers to proxy links.
Sanyam.wikime updated the task description. (Show Details)
Sanyam.wikime updated the task description. (Show Details)

Change 577576 had a related patch set uploaded (by Sanyam.wikime; owner: Sanyam.wikime):
[labs/tools/Isa@master] Replacing url links of static assets (js ,css ) hosted on external servers to proxy links

https://gerrit.wikimedia.org/r/577576

Change 576824 abandoned by Sanyam.wikime:
Replacing url links of static assets (js ,css ) hosted on external servers to proxy links

Reason:
because the merge conflicts can not be solved automatically on web interface, so I used cli and patch is at Change 577576

https://gerrit.wikimedia.org/r/576824

Sanyam.wikime moved this task from In progress to Review on the ISA board.Mar 9 2020, 12:20 PM

Change 577576 merged by jenkins-bot:
[labs/tools/Isa@master] Replacing url links of static assets (js ,css ) hosted on external servers to proxy links

https://gerrit.wikimedia.org/r/577576

Gabrielchl moved this task from Review to Merged on the ISA board.Mar 12 2020, 1:18 PM
Sanyam.wikime closed this task as Resolved.Apr 29 2020, 3:56 AM
Gabrielchl reopened this task as Open.Apr 29 2020, 3:58 AM

Seems like they don't close tasks till the patch(s) is/are deployed.

Seems like they don't close tasks till the patch(s) is/are deployed.

Sure, will keep it open till then.

Looks like this still hasn't been deployed to isa.toolforge.org. Anything stopping that?

Looks like this still hasn't been deployed to isa.toolforge.org. Anything stopping that?

Indeed, the tool is still loading from cdnjs.cloudflare.com and stackpath.bootstrapcdn.com. Can we help with the deployment in any way?

NavinoEvans closed this task as Resolved.Mon, Oct 19, 9:29 AM
NavinoEvans moved this task from Merged to Complete (deployed) on the ISA board.