Lua-cURLv3 accepts libcurl options in the table used to construct an easy handle. Put the proxy there:

local cURL = require "cURL"
local transfer = cURL.easy {
  url = "https://www.example.com/file.bin",
  proxy = "http://proxy.example:8080",
  writefunction = output,
}

local ok, failure = pcall(function()
  transfer:perform()
end)
transfer:close()
if not ok then error(failure) end

This fragment assumes output is a writable file opened in binary mode and owned by the caller. The caller closes it after the operation. The protected call ensures the easy handle is closed when perform raises an error.

The URL still identifies the file. The proxy option selects the intermediary, and libcurl handles the supported HTTP tunnel for the HTTPS destination. For a permitted public-file download with no proxy account, take the HTTP endpoint from an entry in the HTTP proxy list. No manual rewriting of the file URL into a proxy URL is needed.

An explicit option also makes the configuration source clear. libcurl's proxy environment handling is another input; a browser's operating-system proxy preference is not a universal value every Lua networking library obtains automatically.

If the request should follow a managed automatic policy, arrange supported discovery and pass its selected route to the client. The easy option table supplies a fixed route for this transfer.

Erthyglow kevrennek