Laravel 5.4 - Issue with 404 page - php

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, e.g. www.mywebsite.com/asdfa it takes us to 404 page successfully e.g. www.mywebsite.com/404
But when we put a / at the end of the wrong url e.g. 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 i.e. 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}', ...

Related

This site can’t be reached localhost refused to connect

I am getting a very strange error which I have no idea what is going on or how to fix. The strange thing is that I can connect to the /admin on my wordpress site. As soon as I try and view the site it crashes and I get this message - Any Ideas?
I have just downloaded a new copy of wordpress from the website. I go into php my admin create a database and username and password and matching what it is in wp-config file.
I then expect to login to localhost 8887 but as as soon as I hit that route I get to that site the port number disappears and I get this error message.
I have been experimenting with ssh tunneling this week so worried I have may have messed up some config but not really sure where to begin ? I dont think it is a wordpress problem more a networking problem?
In the picture localhost is written with double L-s. Isn't that the problem?
http:// locallhost..

Why am I not able to establish a session on my project on AngularJS, php & MySQL?

I am working on a login system using AngularJS,php, andMySQL. I am following this tutorial on creating an AngularJS user signup and login authentication using php & MySQL. When I put it on "live", I get the error message below:
Failed to load resource: the server responded with a status of 404
(Not Found) angularlogin/files/functions/session:1 Failed to load
resource:
I have checked my phpinfo for session, which is is enabled. What is wrong?
Not the definite answer (comments are too limited), but I spun up the project you linked to, I get almost the same error:
angular.min.js:77 GET .../files/functions/session 500 (Internal Server Error)
But a 500, not 404 so you probably need to give us more info. 404 (file not found) could mean you have forgotten to copy some files?
Anyway:
You can always check the server logs, I got ErrorException: mysqli::__construct(): (HY000/1049): Unknown database 'angularjs_login'. If this is your problem, you've just forgotten to create the database on the server.
During development, don't use the production angularjs (angular.min.js), instead use the non-minified version (angular.js) because you'll get much better error messages!
Open the network tab in your browser dev-tools (press F12), click the failed request (sessions) marked in red when not selected, and if your php-settings allows it, you can see the the error straight away under the preview-tab.
If you are sure you have copied all files, here is a qualified guess:
Your webserver is not configured for slim. Which requires all requests to go through the main index.php, in your case files/functions/index.php. If there is a request to say files/functions/session (which does not exist), the webserver will redirect that request to index.php which sorts the request and passes it along to the right place.
If the request does not go through index.php, then you'll get a 404-error.
Slim solves does this by using a .htaccess-file. files/functions/.htaccess. On windows it might be a hidden file, which could be a reason you've missed it.
Or, your webserver is configurated to not care about .htaccess-files, then you have to change your webserver settings.
Or, you have a webserver that doesn't use .htaccess-files at all, (like nginx) then you have to find another way to redirect those requests. I suggest you have a look at https://www.slimframework.com/docs/v3/start/web-servers.html
There is too little info for us to know for sure, but I think the above seems somewhat likely anyway.

why local remote host gives HTTP Error 404?

we have a website save into my boss computer using nginx server. I set my boss Ip into my host file like this [192.168.15.100 web.local.com]. Last few days ago I can accessed it. But now I cant access. It gives HTTP ERROR 404. Page not found. What could be the solution for this or how can I fix the problem? Thank you :)
In a network "local or not", the ip are given by default dynamically. you must entered in the livebox (192.168.1.1, most of the time), and set the server IP to fixed.
as for the log in the livebox, it is sometimes written on his back.

file_get_contents not working for local files, same issue with cURL

The problem:
file_get_contents('http://google.com'); works fine (works for any external url)
file_get_contents('http://my.server.org/existing_file.php'); returns nothing, and var_dump($http_response_header); returns an empty array when loading any local url.
I get the same empty response using 127.0.0.1 and localhost in place of the domain name.
I've tried/checked:
I've tried using cURL instead as suggested here - I get the same result (works for external URLs, empty response for local).
allow_url_fopen=On and cURL is enabled in php.ini according to phpinfo() - this must be ok, as I can load external URLs without a hitch.
I cannot use include instead, as I need to load a URL with variables to pass to a PDF renderer.
Is there some other php.ini setting that needs to change? Or could it be some other problem? I think it is a configuration issue because my code works fine locally in MAMP, but not on the production server.
Why I am doing this at all:
It's all tied up in a Wordpress functions.php file - I'm basically loading a url like http://my.server.org/path/to/file/?pdf-template, which I then check against the path to load the correct rendering template, which then feeds the rendered php to DOMPDF to generate a PDF file on the fly. Ultimately it means the client can append /pdf/ to any url in their wordpress site and get a PDF version.
What's odd is that this used to work fine on their server, and the person in charge of the server at the client says nothing has changed with the configuration. They have changed webhost in the last month though, which probably has something to do with it.
Update
I managed to pull this from the error log
Notice: file_get_contents(): send of 2 bytes failed with errno=104 Connection reset by peer in /home/path/to/my/file.php on line 19
The problem also appears to be intermittent - sometimes file_get_contents works, sometimes it fails with the above error. There doesn't seem to be a pattern.
Could this be a firewall problem?

Selenium server doesn't work with page after it was redirected

I have a page which is like a splash screen. It performs some work and when it is complete it sends a request with ajax to main application. Main application should redirect to other page if everything is correct.
When I test it on selenium server, it doesn't work properly. It sends test failed after splash screen page. Like it doesn't see the redirection and can't search new contents for specified text.
UPD: Also it gives such error
PHPUnit_Framework_Exception: Response from Selenium RC server for getLocation().
ERROR Server Exception: sessionId should not be null; has this session been started yet?.
Try using browser with elevated security privileges, like *chrome for firefox
For the benefit of anyone else stumbling across this, I had a similar problem, but for me I had called setBrowserUrl with the wrong address - it was the address of my page under test, but it should be the base href of the site. So the 302 Redirect was actually set relative to the value I had passed to setBrowserUrl which landed me at an error page (despite the redirect working perfectly through a normal browser).
To fix the problem I called setBrowserUrl with the main site URL (where all relative links are relative to) and then called url in each test to set the page under test. This got things working again.

Categories