Im new here and would like to ask a question about an error when trying to upload a photo using the memories app.
When selecting a photo in the app and try to send it to my nextcloud server the following error message Spears in the log file:
[webdav] Fout: X-OC-MTime header must be a valid positive integer
I had the same issue uploading large files from Android web browsers via share link, the solution I found for my setup (NGINX reverse proxy) was to replace the negative X-OC-MTime header value sent by the web client with the current time.
I added a map in nginx.conf to replace negative values of X-OC-MTime:
My fix is done in NGINX, first you have to create a new variable that will be the value of $http_x_oc_mtime only if it’s valid, else it will be the current time.
Here’s my /etc/nginx/nginx.conf file (where the variable is defined):
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$http_x_oc_mtime"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
map $http_x_oc_mtime $xocmtimefix { # <-- the new variable
"~^-\d+" "$msec";
default $http_x_oc_mtime;
} # <------------------------------------ the new variable
include /etc/nginx/conf.d/*.conf;
}
Once you modify your nginx.conf you’ll have to restart your NGINX for the variable to be available to be used. Once you have done that, here’s the usage of the variable itself in a *.conf file, in my case I have Nextcloud under the mysite.com/nextcloud path, but it should be the same on the root path if that’s your case:
Once you modify your *.conf file (e.g. default.conf, mysite.conf) you just have to reload NGINX.
Check for <-- in the code examples to get what you have to copy/paste into your NGINX reverse proxy setup.
I did some research and noticed that the timzone in the nextcloud containers is utc. Thats not the zone I live in. I read that the nextcloud containers use their own timezone. I tried to modify it in truenas but its not allowed.
I continu my search for a proper solution, but I like to share this info with you guys.
Here’s the thing: I got the error message after the screen had shown a completed upload. The file did not appear in the folder. I searched for the error, came here and posted this message, and then, after a while, checked the folder. The file upload was successful after all.
A different kind of error than has been described above in this discussion.
I got the same error. I only got the error when I was using Google Chrome browser upload on android and wanted to upload a single large file.
I solved it by uploading the entire folder rather than the single file. I attach screenshots.
The remapping of the mtime value in Nginx works for me, thanks for the solution/workaround @carlosc!
My main question is now: how can this still be an issue after so many years of it existing? If you google this bug, the results go way back.
But that’s just me, ventilating. Glad you found a way to make it work at least.
Hi @TrickyKid, from the NPM docs Advanced Configuration | Nginx Proxy Manager it seems you could replicate the changes to the nginx.conf and proxy server block. I cannot provide the exact details on that as I don’t have such setup.