{"id":16,"date":"2023-02-02T18:31:00","date_gmt":"2023-02-02T10:31:00","guid":{"rendered":"https:\/\/dreamhax.cc\/?p=16"},"modified":"2025-10-18T09:48:48","modified_gmt":"2025-10-18T01:48:48","slug":"setting-up-a-free-pixiv-image-proxy-with-cloudflare","status":"publish","type":"post","link":"https:\/\/en.dreamhax.cc\/index.php\/2023\/02\/02\/setting-up-a-free-pixiv-image-proxy-with-cloudflare\/","title":{"rendered":"Setting Up a Free Pixiv Image Proxy with Cloudflare"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\"><strong>1. Purchase a Domain<\/strong><\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Purpose<\/strong>: You need a domain name to host your proxy service.<\/li>\n\n\n\n<li><strong>Recommended<\/strong>: Choose a cheap domain extension like&nbsp;<code>.xyz<\/code>,&nbsp;<code>.ga<\/code>, or&nbsp;<code>.cf<\/code>.<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>2. Register Cloudflare Account<\/strong><\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Sign Up<\/strong>: Go to&nbsp;<a href=\"https:\/\/dash.cloudflare.com\" target=\"_blank\" rel=\"noreferrer noopener\">Cloudflare&#8217;s official website<\/a>&nbsp;and create an account.<\/li>\n\n\n\n<li><strong>Login<\/strong>: Log in to your Cloudflare dashboard.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">3.Add-site to Cloudflare<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 1<\/strong>: Click&nbsp;<strong>Add Site<\/strong>&nbsp;&gt;&nbsp;<strong>Add a Site<\/strong>.<\/li>\n\n\n\n<li><strong>Step 2<\/strong>: Enter your domain name (e.g.,&nbsp;<code>yourdomain.com<\/code>) and click&nbsp;<strong>Next<\/strong>.<\/li>\n\n\n\n<li><strong>Step 3<\/strong>: Cloudflare will scan your domain\u2019s current DNS records. Click&nbsp;<strong>Continue Setup<\/strong>.<\/li>\n\n\n\n<li><strong>Step 4<\/strong>: Choose&nbsp;<strong>Free Plan<\/strong>&nbsp;(the basic plan is sufficient for a proxy service).<\/li>\n\n\n\n<li><strong>Step 5<\/strong>: Update DNS Nameservers:\n<ul class=\"wp-block-list\">\n<li>Your domain registrar (e.g., Alibaba Cloud) requires updating nameservers to Cloudflare\u2019s:\n<ul class=\"wp-block-list\">\n<li><strong>Nameserver 1<\/strong>:&nbsp;<code>ns1.cloudflare.com<\/code><\/li>\n\n\n\n<li><strong>Nameserver 2<\/strong>:&nbsp;<code>ns2.cloudflare.com<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Follow your domain registrar\u2019s instructions to update nameservers. This step ensures Cloudflare manages your DNS.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">4.<strong>Configure DNS Records<\/strong><\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Proxy Settings<\/strong>:Go to the DNS tab in Cloudflare.<\/li>\n\n\n\n<li><strong>Add a New A Record<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Click&nbsp;<strong>Add Record<\/strong>&nbsp;&gt; select&nbsp;<strong>A record<\/strong>.<\/li>\n\n\n\n<li>Fill in the fields:\n<ul class=\"wp-block-list\">\n<li><strong>Name<\/strong>: Enter&nbsp;<code>pixiv<\/code>&nbsp;(or a custom subdomain name, e.g.,&nbsp;<code>proxy<\/code>).<\/li>\n\n\n\n<li><strong>IPv4 Address<\/strong>: Enter any valid IP address (e.g.,&nbsp;<code>8.8.8.8<\/code>&nbsp;for testing purposes).<\/li>\n\n\n\n<li><strong>TTL<\/strong>: Keep it as&nbsp;<strong>Auto<\/strong>&nbsp;(recommended).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Enable Proxy Status<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Check the box&nbsp;<strong>Proxy this record<\/strong>&nbsp;(the icon will turn orange).<\/li>\n\n\n\n<li>This enables Cloudflare\u2019s proxy for this subdomain.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Save Changes<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Click&nbsp;<strong>Save<\/strong>&nbsp;to apply the configuration.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>5. Set Up Cloudflare Workers<\/strong><\/h1>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to&nbsp;<strong>Workers<\/strong>&nbsp;&gt;&nbsp;<strong>Create a Worker<\/strong>.<\/li>\n\n\n\n<li><strong>Create a New Service<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Click&nbsp;<strong>Create a Worker<\/strong>.<\/li>\n\n\n\n<li><strong>Name<\/strong>: Enter a name (e.g.,&nbsp;<code>pixiv-proxy<\/code>).<\/li>\n\n\n\n<li><strong>Route<\/strong>: Set the route to&nbsp;<code>https:\/\/pixiv.yourdomain.com\/*<\/code>&nbsp;(replace&nbsp;<code>yourdomain.com<\/code>&nbsp;with your domain).<\/li>\n\n\n\n<li>Click&nbsp;<strong>Create Service<\/strong>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Edit the Worker Code<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Go to the&nbsp;<strong>Resources<\/strong>&nbsp;tab.<\/li>\n\n\n\n<li>Click&nbsp;<strong>Quick Edit<\/strong>&nbsp;to open the code editor.<\/li>\n\n\n\n<li><strong>Replace the default code with the following script<\/strong>&nbsp;(explained below):<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>addEventListener('fetch', event =&gt; {\n    let url = new URL(event.request.url);\n    url.hostname = 'i.pximg.net';   \n    let request = new Request(url, event.request);\n    event.respondWith(\n        fetch(request, {\n            headers:{\n                'Referer': 'https:\/\/www.pixiv.net', \/\/Websites that require proxy access\n                'User-Agent':'Cloudflare Workers'   \/\/Proxy server\n            }\n        })\n    );\n});<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">6.<strong>Bind the Custom Domain<\/strong><\/h1>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Return to the Dashboard<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Go back to the Cloudflare dashboard homepage.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Select Your Worker<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Navigate to&nbsp;<strong>Workers<\/strong>&nbsp;&gt; Your newly created service (e.g.,&nbsp;<code>pixiv-proxy<\/code>).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Add a Custom Domain<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Click&nbsp;<strong>Add Custom Domain<\/strong>.<\/li>\n\n\n\n<li>Enter the subdomain you configured in the A record (e.g.,&nbsp;<code>pixiv.yourdomain.com<\/code>).<\/li>\n\n\n\n<li>Click&nbsp;<strong>Add Domain<\/strong>.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h1 class=\"wp-block-heading\">7.<strong>Test the Proxy<\/strong><\/h1>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example Test<\/strong>:<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Pixiv Original Image Link<\/strong>:<code>https:\/\/i.pximg.net\/img-original\/img\/2019\/03\/06\/00\/40\/39\/73532572_p0.jpg<\/code><\/li>\n\n\n\n<li><strong>Proxy Link<\/strong>:<code>https:\/\/pixiv.dreamhax.cc\/img-original\/img\/2019\/03\/06\/00\/40\/39\/73532572_p0.jpg<\/code><\/li>\n\n\n\n<li><strong>Access the Proxy Link<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Open the modified link in a browser. If successful, the image should display.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<div class=\"wp-block-argon-alert alert\" style=\"background-color:#7889e8\"><span class=\"alert-inner--icon\"><i class=\"fa fa-info-circle\"><\/i><\/span><span class=\"alert-inner--text\">Original post:<a href=\"https:\/\/www.theresa3rd.cn\/#\/imgProxy\">https:\/\/www.theresa3rd.cn\/#\/imgProxy<\/a><\/span><\/div>\n<\/blockquote>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>1. Purchase a Domain 2. Register Cloudflare Account 3.Add-site to Cloudflare 4.Configure DNS Records 5. Set Up Cloudflare Workers 6.Bind the Custom Domain 7.Test the Proxy Example Test:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[18,20,17,19],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-service","tag-cloudflare","tag-image","tag-pixiv","tag-porxy"],"_links":{"self":[{"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":6,"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":23,"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/posts\/16\/revisions\/23"}],"wp:attachment":[{"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/en.dreamhax.cc\/index.php\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}