简体   繁体   中英

Laravel 5.4 - Issue with 404 page

I am facing a weird issue with one of my project, the website is hosted on two RHEL 6.9 linux machines and a load balancer is in place, following are the servers configuration:

192.168.10.1 - First server with website and database copy 192.168.10.2 - Second server with website and database copy 192.168.10.3 - Load Balancer 10.66.0.3 - Load Balancer's public IP

Now as you can see, we have same copy of the website and database on two servers (which we manually configured with apache, php and mysql). The website url for example is: www.mywebsite.com

The problem is, when we try to open a wrong URL, eg www.mywebsite.com/asdfa it takes us to 404 page successfully eg www.mywebsite.com/404

But when we put a / at the end of the wrong url eg www.mywebsite.com/asdfa/ it doesn't take us to 404 page, instead it shows Connection Timed Out error and shows the load balancer's public IP address in the url: 10.66.0.3/asdfa

I am not able to find why this is happening. The domain is not pointed to public folder as per laravel's recommendation and I am using .htaccess to remove public from the URL. Could this be the problem?

------- EDIT ---------

Actually, upon inspecting more i have realized that the issue is with the / at the end of the url. Whenever i type any URL, even if its a valid URL but it is ending with / - it takes some time to process the request and then we get the connection timed out error. Please see the error page here: Connection Timed Out error notice i tried to open a valid URL ie mywebsite.com/big-data-analytics which works but when I open same url with a / at the end, it gives me connection timed out error and the url on error page is changed with IP address.

There is a route in your route files that is causing this. It must be. Something like

 Route::get('/{something}/{something}', ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM