srushti_kansagara's avatar

403 error while adding the mulitiple summernote editor in one form

hello, i am using the AdminLte3 dashboard to design and summernote editor for the first time . in my setting section i am using summernote editor for add updateappmsg, privacy policy, terms and conds. , about us . in this form i am trying to send my data through ajax . in this when i try to submit the more then one summernote editor values (with style) together then it is casing me the error of 403 (forbidden). without style it is adding the value perfectly . but when i try to add the values(with style) for only single summernote then it' working fine . but one summernote is saved after that it having the same error in other even tho i tried to only update one editor can someone pls help me ?

here is my code :

index.blade.php

controller.php

 public function update(Request $request)
    {

        try {
            $data = Setting::first();

         	//other field 

            $data->aboutUs = $request->aboutUs;
            $data->updateAppMessage = $request->updateAppMessage;
            $data->privacyPolicy = $request->privacyPolicy;
            $data->termsCond = $request->termsCond;

            // Save the record (insert if new, update if existing)
            $data->save();

            return response()->json(['success' => true , 'message' => 'Settings updated successfully.' , 'data' => $data]);

        } catch(Exception $e) {
            return response()->json(['success' => false , 'message' => $e]);
        }
    }

web.php

  Route::post('/app-settings', [AppSettingController::class, 'update'])->name('app-settings.update');

error :

jquery.min.js:2 
 POST https://mydomain/app-settings 403 (Forbidden)

this is casing in production , in the development it is working all fine

sorry for my poor English , thank you in advance for help !!!

0 likes
9 replies
jayandholariya's avatar

@srushti_kansagara I tested the same on my development environment, and it’s working fine. The 403 Forbidden error might be caused by Content-Length or payload restrictions on the server.

If you are using an Apache server, you can update the php.ini configuration as follows:

post_max_size = 10M
upload_max_filesize = 10M

For an Nginx server, update the Nginx configuration with:

client_max_body_size 10M;

Please try these changes. Additionally, test it using a standard Laravel form submission. If the same error occurs, it indicates that the issue is related to a large payload during the upload process.

srushti_kansagara's avatar

@jayandholariya yahh- that's right it is working in development but not in the production this error is coming only in the production i forgot to mention that

jayandholariya's avatar

@srushti_kansagara Can you try this using a standard Laravel form submission? If the issue is related to a large payload, you should encounter the same 403 Forbidden error.

jayandholariya's avatar

@srushti_kansagara This indicates that the server is not handling large request sizes. You can follow the steps mentioned in the first reply to increase the request size limit.

jayandholariya's avatar

@srushti_kansagara In your production environment, whether you're using Apache or Nginx, update the following settings in your php.ini file and restart the server:

post_max_size = 50M
upload_max_filesize = 50M
max_input_vars = 5000
max_execution_time = 300
max_input_time = 300
memory_limit = 256M

This will help ensure your server can handle larger requests efficiently.

srushti_kansagara's avatar

@jayandholariya i am deploying this project via Hostinger . i have implement this type of 4 summernote editor in one form in my pervious project (first project ) it was working perfectly fine in both environment . just in this project it is throwing this 403 error in porduction

jayandholariya's avatar

@srushti_kansagara Hostinger enables ModSecurity by default, which may block certain requests.

  1. Log in to your Hostinger hPanel.
  2. Go to Advanced > ModSecurity.
  3. Temporarily disable ModSecurity for your domain to test.

If it resolves the issue, consider whitelisting specific rules instead of leaving it off.

Sometimes .htaccess security rules block POST or PUT requests.

<LimitExcept GET POST>
    Deny from all
</LimitExcept>

check in .htaccess that this line exists or not. if exists then remove this and try once.

Please or to participate in this conversation.