406 Error (Not Acceptable): What It Means and How to Fix It
Officially, a 406 means the server won’t send the format you asked for. On most websites it means a firewall such as ModSecurity blocked the request. Here’s how to tell which one you have, and how to fix each.
- Two different errors, one code — a real content-negotiation failure, or a firewall rule borrowing the status.
- Reproduced on a real server — ModSecurity and the OWASP Core Rule Set returning 406, with the log line that fired.
- A fix for each reader — browsing, calling an API or running scripts, or owning the site.
- An IP-block test — compare a direct request with one through a clean IP to see whether the block follows your address.
Real carrier IPs to compare against, so you know whether a block follows you.
If a clean mobile IP still gets a 406, the problem is the request, not the IP.
A 406 error (Not Acceptable) means the server refused to show the page in the format you asked for. It just wouldn’t provide it in that format.
That’s the official definition. But on most websites, a 406 usually means a security firewall (often ModSecurity) thinks your request is suspicious and has blocked it. Solutions differ by case, so first figure out which one you have.
Quick Answer
| Error 406 | |
|---|---|
| Name | Not Acceptable |
| Type | 4xx client error (standard HTTP) |
| Official cause | The Accept headers asked for a format the server doesn’t offer |
| Usual cause on websites | A firewall such as ModSecurity blocking the request |
| Sent by Cloudflare? | No, Cloudflare only passes it on from the site’s server |
| First fix | For browsers: clear the site’s cookies and retry. For APIs: fix the Accept header |
What the 406 Error Code Means
Every HTTP request can state which formats it’s willing to accept. That’s known as content negotiation, and it’s done via headers such as:
Acceptfor the file type (for example,application/jsonortext/html)Accept-Languagefor the languageAccept-CharsetandAccept-Encodingfor character sets and compression
If the server can’t come up with anything on that list and won’t just send a default, the standard response is 406 Not Acceptable.
Most servers don’t usually reach this point. MDN, which most developers use as a reference, says it can be better to send a default version with a 200 status instead of a 406. PyPI (the Python Package Index) does this clearly:
Strict APIs will return an HTTP 406. For example, this test API only supports JSON or CSV, so if you ask for XML, it rejects the request and tells you what formats it can send:
text/csv, the same endpoint responds normally.Cloudflare doesn’t create 406 errors. If you see a 406 error on a site using Cloudflare, it’s actually coming from the site’s own server, and Cloudflare is just passing it along.
Why Websites Show 406 When Nothing Is Wrong With Your Format
On shared hosting, a 406 error often has nothing to do with formats. Many hosts use ModSecurity (a web application firewall) to check every request against a set of rules. If a rule is triggered, the host’s settings decide which error you see, and many use 406.
To show this, we set up Apache with ModSecurity and the OWASP Core Rule Set (a free rule set that many hosts use), and configured it to block requests with a 406 error, just like many shared hosts do:
The server’s error log shows exactly which rule fired:
942100 picked up the SQL pattern, the request’s risk score went over the limit, and rule 949110 blocked it with a 406 error.Real visitors trip these rules more often than you’d think. Common triggers include:
- Form fields or URLs containing code, SQL words, or unusual characters
- Long or odd cookies left over from an old session
- A User-Agent string that’s missing or looks like a bot or scanner
- Uploading files or pasting text that looks like a script
Some hosts will block your IP address in their firewall if you trigger ModSecurity rules too often. After that, the error is linked to your IP, not just your request.
Is It Just You?
- Read the error page.
A lot of firewall error pages will say “Not Acceptable” and then have a line about ModSecurity or a request being blocked. That’s a firewall rule, not a format issue.
- Try loading the same page in a private window.
A private window loads it without your cookies and extensions. If it works there, something in your regular browser was causing the issue.
- Try using a different network.
Use something like your phone’s mobile data. If the page loads, your IP was probably blocked after triggering too many firewall rules.
If You’re Browsing
- Clear the cookies for that one site
Then reload it.
- Turn off any browser extensions that change your requests
Privacy tools, ad blockers, or user agent switchers — then reload the page.
- Change what you submitted
If you got a 406 after sending a form, remove any code snippets, unusual symbols, or very long text, and try again.
- Try a different network
If that solves the problem, wait a bit before using your usual connection again, or contact the site for help.
- Give the site owner the details
Send the page address, the time, and what you were doing. They can use this information to find the matching entry in their firewall log.
If You Use an API or Run Scripts
Send an Accept header with the media type the server supports. Check the API docs for the exact type (some APIs use their own, like GitHub’s application/vnd.github+json). If you’re okay with any format, Accept: */* lets the server choose.
import requests
resp = requests.get(
"https://api.example.com/items",
headers={"Accept": "application/json"},
timeout=30,
)
if resp.status_code == 406:
# A well-behaved API lists what it can send in the body
print("Not acceptable. Server says:", resp.text[:300])
Also check Accept-Language and Accept-Encoding. If you ask for a language the site doesn’t support, or a compression format the server can’t provide, you can get a 406 error too.
Don’t mix up 406 and 415 errors. A 406 is about the format you want to receive. A 415 Unsupported Media Type is about the format you’re sending (your Content-Type). Changing the Accept header won’t fix a 415.
Look like a normal client. If the site is returning a 406 to your script but loads fine in a browser, then it’s very likely a firewall rule is matching on your headers. Send a real User-Agent and normal headers, and absolutely don’t send test strings that look like attacks.
Check if your IP is blocked. If you keep getting 406 errors and even simple requests fail, the site’s host has probably blocked your IP. Try comparing with a clean IP:
export PROXY="http://USERNAME:PASSWORD@uk1.pxm2.io:PORT"
URL="https://target.example/page"
curl -s -o /dev/null -w "direct: %{http_code}\n" "$URL"
curl -s -o /dev/null -w "proxy: %{http_code}\n" -x "$PROXY" "$URL"
If a direct request gives a 406 but a proxied one returns a 200 with the same headers, your IP is blocked. If both fail, the issue is with your request, so a new IP won’t help. Always check any IP you use first — see our guide to IP reputation and trust scores.
Use only public data, follow each site’s terms and conditions, and slow down if you notice a site blocking you.
If You Own the Site
Find the rule. Search your server’s error log for ModSecurity entries at the time of the error:
grep -i "modsecurity" /var/log/apache2/error.log | grep "406" | tail -n 5
On cPanel servers, the log is typically located at /usr/local/apache/logs/error_log. Note the rule ID in the matching lines.
Fix the false positive, not the whole firewall. Turning off ModSecurity for your entire site removes important protection. Here are better options:
- Ask your host to whitelist (turn off) that specific rule ID for that page.
- On a VPS, turn off that rule for the path in question.
- If your control panel has a ModSecurity tool, use that to test the changes on a per-domain basis before you turn anything off.
For your own API, send a default format if possible. If a client requests a format you don’t support, it’s usually better to return your main format with a 200 status instead of a 406. If you must return a 406, include a list of supported formats in the response body, like the test API above.
Check your language and character set settings. Cloudflare notes that the 406s it passes on are typically caused by settings on the origin server, such as language or character set.
406 vs. Similar Errors
| Error | Name | What it means |
|---|---|---|
| 400 | Bad Request | The request itself is broken |
| 403 | Forbidden | You’re not allowed to see this (many firewalls use this instead of 406) |
| 405 | Method Not Allowed | Wrong method, such as POST where only GET works |
| 406 | Not Acceptable | Can’t send any format you asked for, or a firewall blocked you |
| 415 | Unsupported Media Type | The server won’t accept the format you sent |
| 429 | Too Many Requests | You’re sending requests too fast |
If it’s a page on Cloudflare and you’re seeing a 1xxx error (e.g., 1005, 1015, or 1020), then that’s Cloudflare blocking you, not the site’s server. Our guide to common scraping blocks shows how to tell those apart, and if a Cloudflare site shows a 522 instead, see what a 522 error means.
Test With a Clean IP Yourself
Live PXM2 locations — real 4G and 5G carrier IPs to compare against your own connection. Ask support for a free 1-hour trial and test your target site:
France
India
Poland
Frequently Asked Questions
What does an HTTP error 406 mean?
The server couldn’t return a response in any of the formats your request accepted. Often, though, it means a security firewall blocked your request.
Is it my fault that I’m getting a 406 error?
Sometimes. If you’re calling an API, your Accept header might ask for a format the API doesn’t support. If you’re browsing, it’s usually a firewall rule that’s too strict, and the site owner needs to fix it.
How do I fix a 406 Not Acceptable error in the browser?
Clear the site’s cookies, turn off any extensions, and remove any unusual text from forms you’ve submitted. If it still doesn’t work, try another network or contact the site.
Can a VPN or proxy fix a 406 error?
A VPN or proxy will only help if your IP was blocked after too many firewall hits. If the 406 is caused by your headers or what you submitted, it will happen from any IP.
Does a 406 error impact SEO?
Yes, if Googlebot encounters it. Google treats 4xx pages as missing and removes them from its index. Make sure your firewall isn’t blocking search engine crawlers.
Why does ModSecurity return a 406 rather than a 403?
It’s a configuration choice. ModSecurity returns whatever status the server admin sets for blocked requests. Some hosts use 403, but many shared hosts use 406.
Related Mobile Proxy Guides
Once you know whether a block follows your request or your IP, the rest of the cluster covers the fix in detail.
Web scraping guides
Core mobile proxy guides
Find Out Whether the 406 Follows Your IP
Real 4G/5G carrier IPs on dedicated modems — compare your target from a clean address. Ask support for a free 1-hour trial.
Try a Clean Carrier IPSources: MDN: 406 Not Acceptable · Cloudflare Docs: Error 406 · InMotion Hosting: 406 Not Acceptable Error · Namecheap: What is ModSecurity · OWASP Core Rule Set · Google: How HTTP status codes affect Google’s crawlers