Can't download file to my PC via a direct link from the /local-files

This is my docker-compose.yml

version: "3"

services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}N8N_BASIC_AUTH_ACTIVE
      - EXECUTIONS_DATA_SAVE_ON_ERROR=all
      - EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
      - EXECUTIONS_DATA_SAVE_ON_PROGRESS=true
      - EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=false
      - EXECUTIONS_DATA_PRUNE=true
      - EXECUTIONS_DATA_MAX_AGE=90
      - DB_SQLITE_VACUUM_ON_STARTUP=true
      - EXECUTIONS_DATA_PRUNE_TIMEOUT=1000
      - N8N_EMAIL_MODE=smtp
      - N8N_SMTP_HOST=smtp.mailersend.net
      - N8N_SMTP_PORT=587
      - N8N_SMTP_SSL=false
      - [email protected]
      - N8N_SMTP_PASS=pass-from-mailersend
      - [email protected]
    volumes:
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
      - /local-files:/files

I save the file to the server in the folder “local-files”:
6626chrome

Describe the issue/error/question

I can’t download the file to my PC via a direct link:
https://nnn.zapcarsvag.com/local-files/catalog_dron_clean.xls

What could be the problem?

Thank you very much!

Information on your n8n setup

  • n8n version: 0.188.0
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @Mikhail, how are you trying to write the file to your filesystem and which error are you seeing? Perhaps you could share a workflow using which the problem can be reproduced?

1 Like

Hi @MutedJam !

I create the file (catalog_dron_clean.xls) from this workflow (see also below )

I just paste the link (https://nnn.zapcarsvag.com/local-files/catalog_dron_clean.xls) into my browser and want the file to be downloaded to my computer - as usual.

The problem is that I need to use this file in another service and for this it must be downloadable.

For example, this is the link https://zapcarsvag.com/catalog_dron.csv where the file is downloadable - no problem.

1 Like

Are you trying to save the file to /files/catalog_dron_clean.xls, where /files is a docker bind mount to your /local-files folder? If yes than this should work, I quickly tried to doing the same.

Are you sure your /local-files is at the root of your file system? The .. in your provided screenshot suggests that it may not be at root level.

2 Likes

it is the root

The file ( catalog_dron_clean.xls ) is saved to “/local-files” correctly every time a workflow is triggered.

1 Like

So saving the file to /local-files works? Everything in /local-files should be downloadable by your webserver, like the other files in /local-files? Because i see an unauthorized error when I try to download

If that is the case then your webserver might be the culprit. You could check which linux user is creating the files and if your webserver is allowed to read them.

I can’t download a single file from the “/local-files”

yes, The file ( catalog_dron_clean.xls ) is saved correctly

I just noticed - it’s strange that one path is specified in the node, but saves to a different path ( to /local-files), but the file ( catalog_dron_clean.xls ) is saved correctly (the data inside changes).

6628chrome

I do not have a folder “files” in /local-files.

How do I do that?

That is because you are mapping /local-files to /files in your docker-compose.yml.

Do you have any other service running on your server besides the provided n8n and traefik? Because n8n will not make any files downloadable from your server, that is not its job and would also be a security concern. You would need to run another service that makes your /local-files available.

1 Like

Only n8n .

How do I do that?
Or maybe I should change it to store data in a g sheet, It’s probably easier to do?

1 Like

Yes, that would be easier. You could also upload your file using our Google Drive Node.

2 Likes

Thank you @marcus again for your help and time !

1 Like