From: Stamatis Katsaounis Date: Mon, 27 Aug 2018 09:15:49 +0000 (+0300) Subject: Homogenize file size error from nginx with python errors X-Git-Tag: ovp-2.0.0~13^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F61415%2F1;p=dovetail-webportal.git Homogenize file size error from nginx with python errors JIRA: DOVETAIL-732 This patch homogenize error received from nginx when a file is bigger than the limit set with python errors. It tells nginx to convert error 413 to 200 and respond with a json, like python does when validating the file. As a result, the error is shown in the pop up as it should be. Change-Id: I3218516073f848321af02465c5d608ef54d5b715 Signed-off-by: Stamatis Katsaounis --- diff --git a/docker/nginx/sites-enabled/default b/docker/nginx/sites-enabled/default index aa81bd4..bc671b7 100644 --- a/docker/nginx/sites-enabled/default +++ b/docker/nginx/sites-enabled/default @@ -124,6 +124,12 @@ server { expires 1d; } + error_page 413 =200 /413.json; + + location /413.json { + return 200 '{"msg": "Please upload a file less than 20MB.", "code": 413}'; + } + # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests #location /RequestDenied { # proxy_pass http://127.0.0.1:8080;