pikpak: add proxy_url option for download acceleration#9124
Open
nickhoo555 wants to merge 1 commit intorclone:masterfrom
Open
pikpak: add proxy_url option for download acceleration#9124nickhoo555 wants to merge 1 commit intorclone:masterfrom
nickhoo555 wants to merge 1 commit intorclone:masterfrom
Conversation
Add a new configuration option 'proxy_url' that allows users to specify a Cloudflare Worker (or similar) reverse proxy URL for accelerating downloads from PikPak. When configured, download URLs will be routed through the proxy: https://proxy.example.com/https://original-download-url This is useful for users who experience slow direct download speeds from PikPak servers.
Contributor
|
URL format seems to be specific for certain method. Can I ask which tool you used for proxy? |
Author
|
I used a Cloudflare Worker as the reverse proxy. Here's the basic Worker code: addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
// Extract the target URL from the path (e.g., /https://example.com/file)
let url = request.url.substr(8)
url = decodeURIComponent(url.substr(url.indexOf('/') + 1))
if (url.indexOf('://') === -1) {
url = 'https://' + url
}
// Forward the request with original headers
const headers = new Headers(request.headers)
headers.delete('host')
const response = await fetch(url, {
method: request.method,
headers: headers,
body: request.body
})
return new Response(response.body, {
status: response.status,
headers: response.headers
})
}The proxy URL format If there are other popular proxy URL formats that should be supported, I'm happy to add them as well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new configuration option proxy_url for the PikPak backend that allows users to specify a reverse proxy URL for accelerating downloads.
Problem
Some users experience slow direct download speeds from PikPak servers due to network conditions or geographic location.
Solution
When proxy_url is configured, download URLs are routed through the specified proxy.
Usage
Via command line, config file, or environment variable RCLONE_PIKPAK_PROXY_URL.
Testing
Tested with Cloudflare Worker reverse proxy, confirmed working with significant speed improvement.