admin panel errors on production

Hello guys, so I hosted my app on sharedhosting and I encountered this error on admin panel which kinda tricky since it only appears on production and I have this image on console log also comes on error trigger. I tried .htaccess issues but didnt it didnt work. Thankyou in advance!!
51 Replies
Chrysippus
ChrysippusOP17mo ago
Patrick Boivin
Patrick Boivin17mo ago
It's a common error I think... there are a couple of solutions here : https://github.com/livewire/livewire/issues/1779 But likely a weird server configuration issue on the side of your web host. You should try contacting them.
Chrysippus
ChrysippusOP17mo ago
I have no idea if one of the reasons was my provider. I wish this is just something that I can work with to sort it out since im in urgent, I havent have this problem before on admin panel, only happens now but Im still figuring it out what causes it. but thankyou, I'll try to take a look on the thread u sent.
toeknee
toeknee17mo ago
Did you storage link? And it looks like the web root isn't setup right. Shared hosting is a bit of a PITA depending how the server is done.
Patrick Boivin
Patrick Boivin17mo ago
Totally, I hate to be that guy (hated seeing this "advice" earlier in my career) but don't do shared hosting if you have any other options. It's absolutely not worth it.
Chrysippus
ChrysippusOP17mo ago
yes sir. hmm about the server.. my system files were on public_html so my root is public_html then I have this .htaccess thats all I did to make it work
DirectoryIndex index.php
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

RewriteRule ^$ public/index.php [L]

RewriteRule ^((?!public/).*)$ public/$1 [L,NC]

</IfModule>
DirectoryIndex index.php
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

RewriteRule ^$ public/index.php [L]

RewriteRule ^((?!public/).*)$ public/$1 [L,NC]

</IfModule>
I haven't run to this issue last week, only now though.. @pboivin I acknowledge the tips, I just cant afford it right now im sorry for the incompetence.
toeknee
toeknee17mo ago
Your public should be public_html/public
Chrysippus
ChrysippusOP17mo ago
like this sir? RewriteRule ^$ public_html/public/index.php [L] RewriteRule ^((?!public_html/public/).*)$ public/$1 [L,NC]
toeknee
toeknee17mo ago
I've never done it as a rewrite rule it's always flaky. I've just done it as part of the hosting you can set the domains root. But this is more of a laravel issue opposed to a filamentphp issue.
Chrysippus
ChrysippusOP17mo ago
hmm, ok thankyou sir, I'll try other solutions.
toeknee
toeknee17mo ago
Is it cPanel?
Patrick Boivin
Patrick Boivin17mo ago
Can you say what the hosting company is?
Chrysippus
ChrysippusOP17mo ago
z.com sir all I checked from the provider was php version
Patrick Boivin
Patrick Boivin17mo ago
Ok... looks like you should have cpanel, no?
Chrysippus
ChrysippusOP17mo ago
I have sir I've run composer update on their terminal and storage update etc. Idk if there's something I should still run via command but npm commands doesnt work
Patrick Boivin
Patrick Boivin17mo ago
I forgot everything I knew about cpanel but I think you should start there, google for "how to configure cpanel for laravel", it should give you a list of ideas to check in your configuration
Chrysippus
ChrysippusOP17mo ago
note sir, thankyou.. @pboivin @toeknee_iom basically all of my pages that has livewire polling are returning the same errors update: I disabled the erros on cpanel, updated .env APP_DEBUG=false so the error wont showup, but then my console doesnt show any errors too. I wonder why suddenly its working after disabling logging errors what causes it.... as of now its working fine, I standby on my dashboard for 5minutes and so far there's no error coming from console.log this makes no sense if just disabling the loggin/showing error from cpanel and app_debug fixes the issue...
cheesegrits
cheesegrits17mo ago
I don't know if this is what is happening for you, but often the reason front end issues go away when you turn off error reporting is that with error reporting enabled, informational warnings from PHP (often concerning issues which should be fixed but aren't actually breaking your app) get injected into AJAX responses from the server, which then causes any Javascript which interprets the AJAX response to error out. This is one of the many reasons you should disabled debug and error reporting in production.
toeknee
toeknee17mo ago
Ensure you have a proper error reporting tool like sentry or flare so you can actually get the errors and fix them behind the scenes.
Chrysippus
ChrysippusOP17mo ago
Thankyou Sirs for usable tips! UPDATE: I did some digging and I found out that the error more often comes if im using incognito also if I spam the filters of my charts/tables/widgets the error will show this is the error looks like when error logging was off and app_debug = false
Chrysippus
ChrysippusOP17mo ago
this could be a problem to me since my filters have so many values whereas there will be a case where if the admin wanted to check all of the filter then it will be considered as spamming then the error will show up.
toeknee
toeknee16mo ago
Sounds like your server is hitting a mod security rule / filter to prevent injections etc. Check the server error logs and you should see the rule hit, then contact your host to whitelist it.
Chrysippus
ChrysippusOP16mo ago
Hello, I'm starting to think that if I should use other server platform instead coz this sharedhosting wasted too much of my time. do you have any suggestions that is affordable?
toeknee
toeknee16mo ago
DigitalOcean, $5 a month it's what filamentphp website runs on. ideally you should be using a deployment / setup service like forge.
Chrysippus
ChrysippusOP16mo ago
what does forge does?
toeknee
toeknee16mo ago
It builds the servers and deploys your application from github. It's basically a fast streamlined, no-low-code deployment.
Chrysippus
ChrysippusOP16mo ago
Hello Sir, this is my error_logs, hmm is this something that only server can resolve?
toeknee
toeknee16mo ago
Speak to your host, it clearly states denied by server configuration. They will need to whitelist the rule
Chrysippus
ChrysippusOP16mo ago
I've already filed a ticket, thankyou sir!
toeknee
toeknee16mo ago
If they can’t help, you can disable mod_security which is likely the culprit but ideally you shouldn’t for security reasons.
Chrysippus
ChrysippusOP16mo ago
Hello Sir, I dont see any modSecurity on my cpanel
Chrysippus
ChrysippusOP16mo ago
toeknee
toeknee16mo ago
You would do it in the .htaccess as it's unlikely your host is given you access to the mod_security rule.
Chrysippus
ChrysippusOP16mo ago
hmmm, upon searching is it something like this?
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
all of result searching solutions on how to disable it on .htaccess didnt work... im doing it on my public_html/.htaccess
Chrysippus
ChrysippusOP16mo ago
Hello @toeknee_iom they responded to me, atlast, it took them almost 3 days this is what they replied to me..
Chrysippus
ChrysippusOP16mo ago
these are my files on public_html, htaccess, index.php .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]


</IfModule>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]


</IfModule>
index.php
<?php

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));


if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}


require __DIR__.'/../tsibugan-st/vendor/autoload.php';


$app = require_once __DIR__.'/../tsibugan-st/bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(
$request = Request::capture()
)->send();

$kernel->terminate($request, $response);
<?php

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));


if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}


require __DIR__.'/../tsibugan-st/vendor/autoload.php';


$app = require_once __DIR__.'/../tsibugan-st/bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(
$request = Request::capture()
)->send();

$kernel->terminate($request, $response);
cheesegrits
cheesegrits16mo ago
Their response smells like bullshit to me. The error clearly showed it being denied by the server. And no, there is no /livewire folder, but that's irrelevant, it's a route, which doesn't have to corespond to folder structure. It does seem like time to find a better hosting solution. Get a free single site Ploi account with a $5 Digital Ocean droplet, install your app there and see if the problem goes away.
toeknee
toeknee16mo ago
As hugh points out, it's bullshit. 405 error is never triggered within Laravel (I've just double checked the source code). Notice, it says: Client denied by Server Configuration in the logs? Just stop messing with the hosting and run a $5 DO server which can likely run the majority of your sites 🙂
cheesegrits
cheesegrits16mo ago
^^ It'll be a short term pain for a large long term gain.
toeknee
toeknee16mo ago
100%
Chrysippus
ChrysippusOP16mo ago
Hello Sir I replied the same thing and they said they'll look into it again I'm losing hope for their cooperation. Hello Sir, Can I still use the same domain? if I switch to DO?
toeknee
toeknee16mo ago
You can use any domain… just update the DNS records.
Chrysippus
ChrysippusOP16mo ago
What should I choose here sir?
Chrysippus
ChrysippusOP16mo ago
is the $5 dollar enough?
toeknee
toeknee16mo ago
$5 is, but I would highly recommend you use Forge to build it. You'll probably strugle with it doing it that way if you are technically savey
toeknee
toeknee16mo ago
SnapShooter
How to Deploy Laravel on DigitalOcean with Forge - 2020 Full Guide
Once you have finished deploying your product/project on of the most rewarding steps is getting it in production. This guide is going to use forge a tool for
cheesegrits
cheesegrits16mo ago
^^^ this. Unless you have a decent amount of experience setting up servers, use Ploi or Forge to deploy it. Then you don't need to know anything about setting up nginx or MySQL or PHP or Redis or supervisor or cron or (etc etc). Just add credentials and push some buttons in Ploi/Forge. As I mentioned up there ^^, Ploi have a single server free account you can experiment with.
Patrick Boivin
Patrick Boivin16mo ago
Ploi have a single server free account you can experiment with
Did not know that, it's super cool! AFAIK forge also has a free trial period you can use to provision 1 server.
cheesegrits
cheesegrits16mo ago
I mostly use Forge, but have a Ploi account and currently one client deployed with it, and both do the job. Ploi arguably have more / better features.
Patrick Boivin
Patrick Boivin16mo ago
Same, long time Forge user but I'm curious about other options. I'll give Ploi a try on a next small-ish project.
Want results from more Discord servers?
Add your server