question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature?] Block some of requests

See original GitHub issue

Hi @chrisvfritz!, prerender is awesome project and I’m fascinate of it, but i found one problem which I cant resolve 😕 maybe You can help me 😃 I want to prerender my index.html, who have in body this script:

<script>
  WebFontConfig = {
    google: { families: ['Lato:300,400,400i,700,900:latin'] }
  };
  (function () {
    var wf = document.createElement('script');
    var protocol = ('https:' == document.location.protocol ? 'https' : 'http');
    wf.src = protocol + '://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js';
    wf.type = 'text/javascript';
    wf.defer = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })();
</script>

It simple get fonts script from google, added to DOM body to improve loading speed and not have block script on start loading a website.

But when prerender plugin render index.html appear for me block script in head section:

<script src="http://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js" type="text/javascript" defer></script><link href="http://fonts.googleapis.com/css?family=Lato:300,400,400i,700,900&subset=latin" rel="stylesheet" media="all">

Is any possibility to not execute and get data (or replace response with my custom data) for some request, in this example: http(s)://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
JoshTheDerfcommented, Apr 20, 2018

@radzikowski It’s not possible to replace the response data, but you can prevent third-party requests from being loaded by adding skipThirdPartyRequests: true to the renderer config. In this case, loading fonts is not critical for prerendering, so you should add skipThirdPartyRequests: true.

0reactions
JoshTheDerfcommented, Apr 23, 2018

@radzikowski An allow/deny system for individual URLs would likely be ideal, but I haven’t thought through the best way to get it working consistently in all renderers. Feel free to PR if you have an idea. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Block an HTTP Request - tweak browser extension
Request blocking in Chrome or Firefox​ · Open the devtools panel. · Locate the request you wish to block. · Right-click on the...
Read more >
How to use request blocking - Chrome DevTools - Dev Tips
How to use this feature. To use Request Blocking in DevTools: Right click on a resource in the Network Panel. Select Block request...
Read more >
Block Network Requests - Requestly
Block any website or URL with a single click using Requestly's Cancel Request rule, It will make the blocked URL completely inaccessible.
Read more >
How to block a URL in Chrome's developer tools network ...
Right-click on the request in the Network panel and select Block Request URL. A new Request blocking tab pops up in the Drawer,...
Read more >
New Feature: Request Blocker 3.0 (Video)
The new Request Blocker 3.0 feature allows you to customize your Navigation Auto-Request Blocking in four different levels for faster and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found