How to proxy

I am Chinese, you know, I cannot directly visit discordapp, so I try to use workers as a proxy.
code like this:

but got 403 This content is no longer available.

how to fix it? or workers do not support proxy images?


url like this

export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);

  const targetPath = url.pathname.replace("/mj/", "/");
  const targetUrl = '' + targetPath;

    // Copy headers from the original request, but remove any CF headers
  let newHeaders = new Headers();
  for (let pair of request.headers.entries()) {
    if (!pair[0].startsWith('cf-') && !pair[0].startsWith(':')) {
      newHeaders.append(pair[0], pair[1]);

  const modifiedRequest = new Request(targetUrl, {
    headers: newHeaders,
    method: request.method,
    body: request.body,
    redirect: 'manual'

  const response = await fetch(modifiedRequest);

  return response;

  // return fetch(targetUrl);


I want to proxy [Preformatted text]( images

Welcome to the Cloudflare Community!

Workers do support proxying images, as well as any other type of request.

The issue here is - Discord specifically blocked Workers from doing this due to abuse.

Cloudflare Workers make no attempt at hiding themselves, in fact, more of the opposite. Any fetch request outgoing from a Worker sets the CF-Worker header, and that cannot be overriden. As such, Discord simply blocks that. Only Ephemeral Media (like from Slash Commands) and Profile Pictures can be accessed via Workers.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.