somenonymous / OshiUpload

Ephemeral file sharing engine
Do What The F*ck You Want To Public License
164 stars 23 forks source link

Using OshiUpload with Caddy web server to PUT files #5

Closed sxiii closed 2 years ago

sxiii commented 2 years ago

I've recently configured my system to use Bedrock linux and Caddy as web server. So far, so good, config is nice and simple.

My question is, could we use Caddy as web server to host the main uploading dashboard while saving the functionality to curl -T? If yes, is there any config advice? Caddy manages SSL automatically with Let'sEncrypt and also have very low config file footprint. So far, was working really good for me.

Thanks!

sxiii commented 2 years ago

Figure it out myself. Caddy Config (Caddyfile) if somebody want it is very simple:

your.domain.tld
reverse_proxy 127.0.0.1:4019

Works pretty nicely.

sxiii commented 2 years ago

Now trying to configure Caddy to accept PUT requests and forward it to Oshi:

my.domain.tld {
        reverse_proxy 127.0.0.1:4019
}

cl.my.domain.tld {
        reverse_proxy 127.0.0.1:4020
}

After I do curl -T file.txt https://cl.my.domain.tld I got 502 error all the time...

marcovelon commented 2 years ago

Just tried it with caddy v2.4.3 and was unable to reproduce your issue. Uploading via curl -T works just fine on a self-signed https. Try enabing debug in your config by adding this before your subdomain blocks:

{
 debug
}

Then check logs after interacting via curl.

somenonymous commented 2 years ago

Separate PUT server isn't needed anymore in the last commits, webapp.pl now can handle both POST and PUT uploads.