Skip to content

attachment

Setting the content-disposition response header field allows the request to be directly converted to a download. Similar to Koa's attachment method: https://koajs.com/

Rule Syntax

txt
pattern attachment://filename [filters...]
ParametersDescriptionDetailed Documentation
patternExpression to match against the request URLMatch Pattern Documentation
filenameThe name of the file to be displayed after downloading, such as test.txt
• Inline/Embedded/Values content
⚠️ Loading data from files/remote URLs is not supported
filtersOptional filters, supporting matching:
• Request URL/Method/Header/Content
• Response Status Code/Header
Filter Documentation

Configuration Example

txt
https://www.example.com/ attachment://example.html

Browser Access https://www.example.com/ automatically downloads the example.html file.

Associated Protocols

  1. Directly modify the request header: resHeaders://content-disposition=attachment;filename="example.html"