×

Troubleshooting search error 422

 
When you use the advanced search feature in HTML files exported from Dr.Explain, you may encounter error messages with code 422 instead of search results.
 
A 422 error means the web server is forwarding requests to the backend, but the path is incorrect. This is usually a web server configuration issue.
 

Common causes

 
  • Missing path capture in nginx: add /$1$is_args$args to the proxy_pass directive.
  • Missing path capture in Apache: add /$1 to the RewriteRule.
  • Typo in the location pattern: make sure it says /drexsearch/ not /drxsearch/.
 

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 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: Fix web server configuration

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

For nginx servers:

 
Your configuration should look like this:
 
location ~ /drexsearch/(.*)$ {
    proxy_pass http://127.0.0.1:8082/$1$is_args$args;
}
 
Common mistake: missing the /$1$is_args$args part:
 
location ~ /drexsearch/(.*)$ {
    proxy_pass http://127.0.0.1:8082;
}
 

For Apache servers:

 
Your configuration should look like this:
 
RewriteEngine On
RewriteRule ^(?:.*/)?drexsearch/(.*)$ http://127.0.0.1:8082/$1 [P,L]
 
Common mistake: missing the /$1 part:
 
RewriteRule ^(?:.*/)?drexsearch/(.*)$ http://127.0.0.1:8082 [P,L]
 
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: "upstream sent unexpected response code 422".
Made by Dr.Explain, software documentation tool