blue-ox.nl From coffee-fueled fruity tech to fast runs—think different, let’s run them.

Upload to drive via WebDAV / reverse proxy

U

Wauw this took a while, ultimately I found the cause of all troubles myself. But all basic information I needed I gathered over the internet and via clause.ai.

Setup

Reverse Proxy: NGINX Proxy Manager via Docker on my network Raspberry Pi
Local DNS: Via AdGuard on my network Raspberry pi

Upfront

Using the word <webdav> in your (sub)domain might /wil cause problems because some systems possibly uses the domain name (with webdav in it) internally for certain routing or validation. These kinds of issues with specific subdomains sometimes occur in applications that have certain expectations about URL structures.

Mind you: the cash of CloudFlare and/or Nginx could give problems also when trying something (with the right subdomain, but changind details that don’t work). IU ended up by creating a final subdomain and didn’t change anything anymore. You could sole this with:

I tried to use port 9090, because I wasn’t sure if any other service/server is listening to port 8080, but at the end that seemd not good to work (combination NGINX – webdav on Rpi). So I used the default webdav port 8080 and it works. So probably not another server is listening (AdGuard, Unifi, NGINX itself etc)

I recommend using rclone for WebDAV on your Raspberry Pi – it’s lightweight, stable, and easy to configure. Here’s a detailed step-by-step guide to get you started.

USB-schijf koppelen en configureren

Sluit je USB SSD-schijf aan op de Raspberry Pi
Controleer of de schijf correct is gekoppeld,

<code>lsblk</code>Code language: HTML, XML (xml)

The get the UUID of the drive (you could also use the PARTUUID, but I prefer the UUID),

sudo blkid


Maak een mountpoint aan en monteer de schijf, I use the map Immich-Library because the external, via reverse proxy webdav drive, is my Immich Library drive,

<code>sudo mkdir /mnt/Immich-Library</code>Code language: HTML, XML (xml)
<code>sudo mount /dev/sdX1 /mnt/Immich-Library</code>Code language: HTML, XML (xml)


Arranging ownership and permissions,

sudo chown -R <USER>:<USER> /mnt/Immich-LibraryCode language: HTML, XML (xml)
sudo chmod -R 755 /mnt/Immich-Library


Voeg het mountpoint toe aan /etc/fstab om automatisch te mounten bij opstarten,

UUID=<UUID> /mnt/Immich-Library ext4 noauto,x-systemd.automount,nofail,defaults 0 2Code language: HTML, XML (xml)

Install rclone (the webdav service/server)

First, update your package list and install rclone:

sudo apt-get updateCode language: JavaScript (javascript)
sudo apt-get install rcloneCode language: JavaScript (javascript)


Create WebDAV Configuration
Create a configuration file for the WebDAV server:

Configureer Rclone voor WebDAV:

Start de configuratiewizard,

<code>rclone config</code>Code language: HTML, XML (xml)


Maak een nieuwe configuratie (bijvoorbeeld usbwebdav):

  • Kies n voor nieuw
  • Geef een naam, bijvoorbeeld immich_library_webdav
  • Kies webdav als type remote
  • Kies http://127.0.0.1:8080
  • Vendor: other
  • Stel gebruikersnaam en wachtwoord in
    • (I used a different user then the RPi user > that works, it also works with the RPi user, but I don’t like that
    • Be aware: during the webdav connection from your computer/iphone etc you need also this new user, not your RPi user
  • Gebruik de standaardwaarden voor overige instellingen.

Test je WebDAV-configuratie

Start de Rclone WebDAV-server lokaal (with the user as defined during config)

<code>rclone serve webdav /mnt/usbssd --addr :8080 --user gebruiker --pass wachtwoord</code>Code language: HTML, XML (xml)


Controleer lokaal via een browser of bestanden toegankelijk zijn op http://localhost:8080.

Rclone WebDAV als een service draaien

Zorg dat de Rclone WebDAV-server altijd draait
Maak een systemd-service,

<code>sudo nano /etc/systemd/system/rclone-webdav.service</code>Code language: HTML, XML (xml)


Voeg de volgende configuratie toe,

And here: USR = RPi User !!! GRP = RPi-Group of your RPi User
<user> and <pwd> are the once difined during config.

[Unit]
Description=Rclone WebDAV
After=network-online.target

[Service]
Type=simple
User=USR
Group=GRP
ExecStart=rclone serve webdav /mnt/Immich-Library --addr :8080 --user <user> --pass <pwd>
Restart=on-abort

[Install]
WantedBy=multi-user.targetCode language: HTML, XML (xml)


Activeer en start de service,

<code>sudo systemctl enable rclone-webdav</code>Code language: HTML, XML (xml)
<code>sudo systemctl start rclone-webdav</code>Code language: HTML, XML (xml)

Reverse Proxy (NGINX)

Nginx proxy host > Details tab

Scheme: http
Forward Hostname / IP: <IP address> of your webdav RPi
Forward Port: Port of your webdav RPi installation (default: 8080)
Block Common Exploits: OFF
Websockets Supprt: OFF

Nginx proxy host > SSL tab

Force SSL: ON
HTTP/2Support: OFF

Nginx proxy host > Advance tab > Custom Nginx Configuration

proxy_set_header Destination $http_destination;
proxy_set_header Overwrite $http_overwrite;
proxy_set_header Depth $http_depth;
proxy_read_timeout 600;
proxy_send_timeout 600;
client_max_body_size 0;
proxy_http_version 1.1;
proxy_request_buffering off;Code language: PHP (php)

sources (references) & credits

Basically all input/information came from the websites below. So credits and thanks to those content creators and subject matter experts. The only reason I mainly copy/paste their content is to guarantee I have a backup for myself and because multiple times I had to change and adapt. So archiving the “scripts” as I executed it succesfully is inportant for me.

https://claude.ai

About the author

Add comment

By Erik
blue-ox.nl From coffee-fueled fruity tech to fast runs—think different, let’s run them.

Pages

Tags