Redirecting url's to local files

1,066 views
Skip to first unread message

crackruckles

unread,
Feb 25, 2019, 2:45:31 AM2/25/19
to Chromium Extensions
Hi everyone,


Im looking at developing an extension that redirects requests to major java script libraries to a local copy that is checked for updates once a day i.e jquery to speed up web page load times,
but before i start i want to know if its even possible to redirect to local files or if this is disabled for security reasons.

Any ideas?

Sachin Jain

unread,
Feb 25, 2019, 11:58:44 PM2/25/19
to Chromium Extensions
Hey,

As far as I know, you cannot redirect HTTP(s) resources to file:// based resources using webRequestAPIs.
You can set up a localhost server to host these files and then use webRequestAPIs to perform the redirects.

You can try using existing Redirect extensions and see if they can help you achieve this use case. 
A word of caution: There are some planned changes in webRequest APIs in Manifest V3 proposal. 

You can try Requestly to setup Redirect for this use case and Requestly has a File Library feature which allows you to host your files to get an https URL for your scripts.
So you don't need to set up your localhost server in order to set up redirects.

Hope it helps!

Sachin
Reply all
Reply to author
Forward
0 new messages