Akkadius / glass-isc-dhcp

Glass - ISC DHCP Server Interface
MIT License
707 stars 144 forks source link

Error 413 while saving configuration #101

Open demik opened 1 year ago

demik commented 1 year ago

We had an issue saving configuration after a while. "Save Buton" would be doing nothing and resulted of an error 413 in node console

POST /dhcp_config_save 413 77.853 ms - 108 Turns out the default size limits for POST data are too small. Our configuration file is a little less than 100kB. Increasing default values resolve this issue. Proposed patch:

index e77586f..81a9f06 100644
--- a/app.js
+++ b/app.js
@@ -12,8 +12,8 @@ var glass_config = json_file.readFileSync('config/glass_config.json');
  * Init Express plugins
  */
 app.use(logger('dev'));
-app.use(bodyParser.json());
-app.use(bodyParser.urlencoded({extended: false}));
+app.use(bodyParser.json({limit: '1mb'}));
+app.use(bodyParser.urlencoded({limit: '1mb', extended: false}));
 app.use(cookieParser());
 app.use(express.static(path.join(__dirname, 'public')));

Regards