Hello everyone,
We have an Appwrite application behind an Nginx reverse proxy (setup based on @Steven guide ). We're encountering a 413 error when attempting to upload a 2MB file via a function. The _APP_STORAGE_LIMIT
is set to 30000000, and client_max_body_size
is set to 30M in both the server and location sections of the Nginx proxy hosts configuration.
Unfortunately, I haven't been able to find any useful logs from either Appwrite or Nginx. Could anyone suggest what might be causing this issue or how to enable more detailed logging to diagnose the problem? We are using Nginx version openresty/1.21.4.3 and Appwrite version 1.5.4.
Thanks for any help you can provide!
You could try adding below in you server
block -
server {
client_max_body_size 10M;
// other configuration here...
}
@darShan Yes, I have done that and unfortunately, it still doesn't work. 😦
my bad, i missed that in your post. can you print the env vars via docker? what does it show?
Any specific vars you are looking for? Don't want to copy paste sensitive information.
_APP_FUNCTIONS_SIZE_LIMIT=30000000
Those vars are loaded correctly
Edit: Files that are under 1MB have no problem with upload Edit n.2: I can upload 20MB file to storage directly
What do you mean you can upload directly?
I'm leaning towards something being wrong with your nginx config. This is an nginx error.
By uploading to storage directly I meant that I can go to Console -> Project -> Storage -> Create new file -> upload 20MB image. But with Node.js function I can't go over 1MB.
Regarding the configuration of Nxing, I followed the official docs of Nginx proxy manager, edited proxy host via advanced tab in web gui, edited the proxy conf outside the container and even went to the container itself to edit nginx.conf. Unfortunetly non of that worked
What's the difference between nodejs function and the console. Is both through nginx?
It should be, yeah. Console is on the same domain as api requests go and since the domain is the one i have configured in nginx, they should both go through nginx.
I don't recommend editing the file directly. Reading it to check what the config looks like is fine, but you should use the advanced config in NPM. Please share details of what you have configured.
At first I tried to edit advanced options like in the picture.
This wasn´t working so i tried to edit the /data/nginx/custom/server_proxy.conf (with client_max_body_size 30M
line ) which is included at the end of this configuration file stored in /data/nginx/proxy_host
map $scheme $hsts_header {
https "max-age=63072000; preload";
}
server {
set $forward_scheme https;
set $server "appwrite-traefik";
set $port 443;
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name appwrite.example.com;
# Let's Encrypt SSL
include conf.d/include/letsencrypt-acme-challenge.conf;
include conf.d/include/ssl-ciphers.conf;
ssl_certificate /etc/letsencrypt/live/npm-1/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/npm-1/privkey.pem;
# Block Exploits
include conf.d/include/block-exploits.conf;
# Force SSL
include conf.d/include/force-ssl.conf;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
access_log /data/logs/proxy-host-1_access.log proxy;
error_log /data/logs/proxy-host-1_error.log warn;
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
# Proxy!
include conf.d/include/proxy.conf;
}
# Custom
include /data/nginx/custom/server_proxy[.]conf;
}
This unfortunetly didn't work either so i removed the server_proxy.conf and pasted the client_max_body_size 30M
both in server block and location / block of this config file.
When even this didn´t do it, I tried to edit the nginx.conf inside the container again with client_max_body_size 30M
, but already reverted this edit.
And what's your function code?
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...