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.

All media are blocked! Any solution?

See original GitHub issue

Hi, When I send request, I got url media data. such as profile picture url, photo media, video media. Like:

https://scontent-mct1-1.cdninstagram.com/v/t51.2885-19/s150x150/80028426_977596955970756_3505648007456489472_n.jpg?tp=1&_nc_ht=scontent-mct1-1.cdninstagram.com&_nc_ohc=Jz0204Q7lF8AX-KvWCl&edm=AJlpnE4BAAAA&ccb=7-4&oh=bce97e0cdd96fc84aed14131a02fc8af&oe=60BE5E3A&_nc_sid=312772

But when I want to load data in browser the request will be block:

< img src="https://scontent-mct1-1.cdninstagram.com/v/t51 ..."  / >

I got this error message in chrome inspect element developer tools

Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE

Any solution?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
shamshiraneescommented, May 16, 2021

Create new worker in CloudFlare and paste below code

async function handleRequest(request) {
  let url = new URL(request.url)
  if (url.pathname.includes('cdninstagram.com')) {
    let newUrl = url.pathname.replace(/^\/+/, '').replace('https:/', 'https://') + url.search
    let response = await fetch(newUrl.toString(), request)
    response = new Response(response.body, response)
    response.headers.set('cross-origin-resource-policy', 'cross-origin')
    return response
  }
  return new Response("Bad url", { status: 404 })
}

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

This is working 👍🏻. https://gist.github.com/restyler/6c51e3ad20d7596e799d76e87cf93236

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix a website with blocked mixed content - Web security
The best strategy to avoid mixed content blocking is to serve all the content as HTTPS instead of HTTP. For your own domain,...
Read more >
Know Your Rights: Social Media Blocking by Public Officials
Step 1: Collect any information that shows the social media account is used for government business and proves that you were blocked, including...
Read more >
Website Blocked by Facebook? Here's How to Fix It - ThemeIsle
Is your website blocked by Facebook? Here's how to fix the problem so that you and others can share your website on Facebook...
Read more >
Block or allow pop-ups in Chrome - Android - Google Support
You can block notifications if you don't want any communications from a site to show up on your screen. ... Not all pop-ups...
Read more >
Block or unblock external content in Office documents
Blocking external content helps to prevent Web beacons and other intrusive methods that hackers use to invade your privacy and lure you into...
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