Respond with file download to incoming HTTP request

Nodes

9dd572aa-e531-4ffe-a66c-58ac7003ac5d3b9f1b78-6b80-4575-aa6c-9669870003892cf69bf8-d025-41db-983e-898d5f3acf5a

Categories

Created by

ToTom

Last edited 38 days ago

This simple workflow demonstrates how to get an end user's browser to download a file. It makes use of the Content-Disposition header to set a filename and control the browser behaviour.

A use case could be the download of a PDF file at the end of an application process or to export data from a database without replacing the current page content in the browser.

With this approach, the current page remains open and the file is simply downloaded instead:

The original idea was first present here by @dickhoning in the n8n community.

New to n8n?

Need help building new n8n workflows? Process automation for you or your company will save you time and money, and it's completely free!