I experienced an odd error recently. Here’s the message:
No route found for the request
It appeared in my browser info with no other data — no padding, no html, no images, nothing — just that single error message. This was a strange error. I had done previous development on this project. It was working at one point not long ago – So why wasn’t it now?
I’m working on Macbook Pro 15″ Retina. I’m using the Apple-provided Apache and MySQL servers. I use NGrok to provide consistent hostnames and a tunnel to my machine. This lets me access my projects via a mobile device or my desktop browsers. My primary browser is Firefox. This project is a WordPress Multi-site with 3 URLs. The hostnames have been changed to protect the innocent.
No route found for the requestPotential Causes
Why would I get this error now? There are a few high level areas:
- Network Connectivity
- Application Configuration
- Web Server Configuration
- Application Logic
- External Servers
Checking network conection is the first thing to check with this type of problem. In this case however, it can be eliminated since the application resides on my machine. I am using NGrok, so that could be a potential cause. However, the url for
http://clientname.ngrok.io works. So that’s not the problem.
I checked my
.htaccess file. It was using the standard WordPress .htaccess settings — which looks like what most other web applications would use. However, since I’m using Multisite, the .htaccess needs several more things added to it. So I quickly searched the web for ‘WordPress multisite .htaccess’ and quickly found a sample and copied it to my .htaccess file. That didn’t solve my problem, but it’ll helps me get my ducks in a row.
Web Server Configuration
The weird part of this error was how it was displayed. Like it wasn’t WordPress giving me the error. If it were, there would be more HTML in the output. So it the error had to be between the network and WordPress. What’s between them? Apache. I could reach the main site, but neither of the subdomains. Perhaps there was something wrong with their virtual host setups? It turns out the VirtualHost definitions were missing! So I copied the VirtualHost for clientname.ngrok.io and made duplicates for
three.clientname.ngrok.io. The only values that needed to be changed were the
ServerName settings. Restart Apache, and voila! Problem solved! The “No route found for the request” error was gone, and the site loaded normally.
This was a weird problem. The search engines weren’t helpbul with finding a solution. So, I wrote this article for the next time that I have this problem. I’m remebering now that I ran an Apple update a few weeks ago, part of which updated the command line tools. You know how it goes — You do the updates, so it’ll stop nagging you, and you can get on with your life. Then you move on. The lesson here is that things change – whether you want them to or not. Check your assumptions. Even though you may swear up and down that you didn’t change anything – something changed.
When you get stuck on a problem like this, try to think about the process in high level terms, try to narrow it down, and of course – don’t panic.