×

Troubleshooting search error 404

 
When you use the advanced search feature in HTML files exported from Dr.Explain, you may encounter error messages with code 404 instead of search results.
 
A 404 error means the web server cannot find the page or file the browser is trying to load. This is always a web server configuration issue, not a problem with the backend since the backend is configured not to return error code 404.
 

Common causes

 
  • Typo in URL: check that you're using the correct URL path.
  • Missing configuration: the web server doesn't have a rule to handle /drexsearch/ requests.
 

Step 1: Test the backend in browser

 
  • Open your documentation in a web browser.
  • Click on any topic in the menu.
  • In the browser's address bar, change the URL by removing the filename at the end and adding /drexsearch/ping, for example:
    Change from: http://your-server.com/docs/some-file.htm
    Change to: http://your-server.com/docs/drexsearch/ping
  • Press Enter.
 
What you should see: a message saying "If you see this text, Dr.Explain Search Backend is working..."
 
If you see this message: the backend is working, but your web server is not configured to forward search requests correctly. Go to Step 3.
 
If you see this error (or similar):
 
{"error":"URL \"/drexsearch/ping\" is invalid..."}
 
This means your web server is adding an extra prefix (/drexsearch in example above) when forwarding to the backend. Go to Step 3.
 
If you get a different error: the backend might not be running. Go to Step 2 to check if the backend service is running.
 

Step 2: Test the backend directly

 
If you have access to the server, connect to it (e.g. via SSH) and open a terminal, then try this command:
 
curl http://127.0.0.1:8082/ping
 
What you should see: a message saying "If you see this text, Dr.Explain Search Backend is working..."
 
If you see this message: the backend is working, but your web server is not configured to forward requests correctly. Go to Step 3.
 
If you get an error: the backend might not be running. Go to Troubleshooting search error 502 to check if the backend service is running.
 

Step 3: Check web server configuration

 
This step requires access to your server's configuration files.
 

For nginx servers:

 
Check that your configuration includes this section:
 
location ~ /drexsearch/(.*)$ {
    proxy_pass http://127.0.0.1:8082/$1$is_args$args;
}
 

For Apache servers:

 
Check that your configuration includes:
 
RewriteEngine On
RewriteRule ^(?:.*/)?drexsearch/(.*)$ http://127.0.0.1:8082/$1 [P,L]
 

Common mistakes to look for:

 
  • Typo in the path (e.g., /drxsearch/ instead of /drexsearch/).
  • Missing the /$1$is_args$args part in nginx or $1 in Apache configuration.
  • Wrong document root path.
 
If you find a mistake: correct the configuration and restart your web server. Then test again.
 

Step 4: Check error logs

 
This step requires access to your server's log files.
 

For nginx:

 
sudo tail -f /var/log/nginx/error.log
 

For Apache:

 
sudo tail -f /var/log/apache2/error.log
 

Look for messages like:

  • "file not found" — the file doesn't exist at the specified path.
  • "Primary script unknown" — Apache cannot find the script file.
  • "upstream not found" — the backend path is misconfigured.
Made by Dr.Explain, software documentation tool