ZizzyDizzyMC / linx-server

Self-hosted file/code/media sharing website. ~~~~~~~~~~~~~~~~~~~ Powers https://put.icu
GNU General Public License v3.0
217 stars 33 forks source link

400 for each upload #30

Open GankuShi opened 2 years ago

GankuShi commented 2 years ago

Hi, when trying to upload, no matter what file/size/origin it throws 400.

Config below, bind = 192.168.0.131:3001 siteurl = https://192.168.0.131:3001/ cleanup-every-minutes = 120 allowhotlink = true filespath = files/ metapath = meta/ selifpath = f remoteuploads = true

Using version 2.3.8

unisn-g commented 2 years ago

I was able to solve this by changing siteurl = https://mylinx.example.org/ to siteurl = http://10.8.0.1:8080. Not sure if this helps, because the only difference is I'm not using https (and the trailing '/'), which might be a deal breaker for you. Might help you to debug tho. Edit: I think it has something to do with the url to the file. If the url is somehow invalid, it doesn't know where to place the file.

m-primo commented 4 months ago

I'm getting this issue whenever I run the instance behind a reverse proxy. The only solution that seemed to work is what @unisn-g said.

I set siteurl to the same url I'm uploading from, for example if you're running the instance behind a reverse proxy on some url or some vpn or whatever, let's say example.com or 10.8.0.1 with port 8080, you have to set it to http://example.com:8080/ or http://10.8.0.1:8080/, and so on. This is really bad and it's not the expected behavior at all, as the documentation itself says for thesiteurl`:

default is inferred from execution context

So, the expected behavior when we not set the siteurl it should be whatever "host" is running it on.

Another thing, it shows 400 in the network tab without any error the only response is literally {"error": ""}, and nothing even shows in the UI, you have to open the network tab to see what's really going on after uploading. And same for the logs.