fluidd-core / fluidd

Fluidd, the klipper UI.
https://docs.fluidd.xyz
GNU General Public License v3.0
1.39k stars 424 forks source link

Unable to download logs and config files when using auth/authz with moonraker #1317

Closed samwiseg0 closed 8 months ago

samwiseg0 commented 8 months ago

Fluidd Version

fluidd: v1.27.1-2056453

Browser

Chrome, Safari

Device

Desktop PC

Operating System

macOS

What happened

When trying to download log/config files from fluidd while using authz with moonraker. Files cannot be downloaded. This has been an issue for some time but I have not had time to file this bug.

In safari, a dummy file is downloaded with error: {"error": {"code": 401, "message": "Unauthorized", "traceback": "Traceback (most recent call last):\n\n File \"/home/pi/moonraker-env/lib/python3.9/site-packages/tornado/web.py\", line 1767, in _execute\n result = self.prepare()\n\n File \"/home/pi/moonraker/moonraker/app.py\", line 578, in prepare\n self.current_user = auth.check_authorized(self.request, self.endpoint)\n\n File \"/home/pi/moonraker/moonraker/components/authorization.py\", line 807, in check_authorized\n raise HTTPError(401, \"Unauthorized\")\n\ntornado.web.HTTPError: HTTP 401: Unauthorized (Unauthorized)\n"}}

In chrome an error will popup.

After adding a client as trusted there is no issue downloading files. This could be a moonraker issue but I am unsure as the request is coming from fluidd?

What did you expect to happen

The log file to be able to be downloaded while having authz configured in moonraker.

How to reproduce

Configure moonraker to prompt non trusted clients to auth.

Navigate to any log/config file in the printer data dir. Try and download.

Additional information

No response

matmen commented 8 months ago

I can't reproduce this in either Firefox or Chrome on Windows. Can you share your moonraker.log, fluidd-access.log and your moonraker.conf (either by turning forced logins off or using scp)?

samwiseg0 commented 8 months ago

Sure here is all the logs. unable_to_download_files.zip

samwiseg0 commented 8 months ago

Just for clarity. I do not have force_logins set to true. I just omitted my client from the trusted clients list.

matmen commented 8 months ago

Ahh, thanks for the clarification! I can reproduce it now, I'll take a look at it

samwiseg0 commented 8 months ago

Ahh, thanks for the clarification! I can reproduce it now, I'll take a look at it

Awesome! Thank you!