Ошибка 400 Request Header Or Cookie Too Large в веб-сервере Nginx встречается достаточно редко. Данная ошибка означает, что отправленный запрос к веб-серверу слишком большой и был отклонен. Это может происходить по разным причинам.
Например, такое бывает, когда идет переход к веб-сайту из поисковой системы, и какой-то заголовок оказался слишком длинным. В этом случае Nginx «не ожидал» такого большого объёма в заголовке и сбросил соединение. В этой статье будет рассмотрено описание данной ошибки и как ее можно исправить.
Ошибка 400 Request Header Or Cookie Too Large воспроизводится, когда размер заголовков HTTP/HTTPS запроса больше допустимого предела. Например, браузер отправляет слишком много Cookie файлов или отправленный запрос к веб-серверу имеет слишком большой размер.
Запрос принято разделять на две части: заголовки — где находится общая информация и мета данные, и тело запроса. Тело запроса, как и заголовок может быть разного размера — как маленьким, так и большим и его размер как правило не вызывает никаких проблем. Однако если в настройках веб-сервера задан параметр на ограничение длины заголовка запроса, то есть вероятность получить данную ошибку. Скриншот с ошибкой изображён ниже:
Как исправить ошибку Request header or cookie too large в Nginx
Для исправления данной ошибки (если вы администратор веб-сервера Nginx) необходимо увеличить максимальный размер заголовка при помощи изменения параметра large_client_header_buffers. Если же вы обычный пользователь веб-сайта, на котором возникла данная ошибка то необходимо дождаться пока ошибку исправит администратор ресурса.
Для исправления данной ошибки со стороны веб-сервера Nginx необходимо подкорректировать параметр large_client_header_buffers. Данный параметр принимает 2 числа, например 4 и 8 (которые заданы по умолчанию). Первое число — значение, которое задаёт максимальное число буферов, а второе число отвечает за размер буфера, в который считывается заголовок запроса. В второй параметр задаётся в килобайтах.
Данную строку необходимо добавить в секцию http конфигурационного файла конфигурационного файла Nginx или в секцию server для определённого сайта. Конфигурационные файлы веб-сайтов в Nginx обычно хранятся в /etc/nginx/conf.d/ или в /etc/nginx/sites-available/ (в зависимости каким образом был установлен Nginx — при помощи стандартных репозиториев операционной системы или при помощи репозитория Nginx).
Для корректировки значения можно задать числа 8 и 64 подходящие для хранения больших заголовков. В итоге параметр будет выглядеть следующим образом:
large_client_header_buffers 8 64k;
После того как были внесены изменения в конфигурационный файл необходимо перезапустить Nginx при помощи команды:
sudo systemctl reload nginx
Выводы
В этой небольшой статье была рассмотрена ошибка 400 Request Header Or Cookie Too Large Nginx. Если у вас есть доступ к серверу, на котором расположен сайт, на котором возникает данная ошибка, то вы можете исправить ее за несколько минут. Если у вас остались вопросы, спрашивайте в комментариях!
Статья распространяется под лицензией Creative Commons ShareAlike 4.0 при копировании материала ссылка на источник обязательна .
Об авторе
Ошибка Request Header Or Cookie Too Large (Перевод «Request Header Or Cookie Too Large» звучит как «Заголовок запроса или куки слишком большие». ) возникает, когда nginx получает от браузера слишком большой заголовок запроса, это случается когда размер заголовков запроса больше допустимого предела установленного в настройках nginx’а. Например, ваш браузер отправляет на сервер слишком много cookies из-за этого размер запроса может быть достаточно большим и вы можете получать такую ошибку.
Решение проблемы
Для решения проблемы «Request Header Or Cookie Too Large» следует выполнить следующее:
- закрыть браузер, а потом заново его откройте. Несмотря на простоту данного совета, в некоторых случаях он оказывается довольно эффективным;
- Временно отключите ваши антивирус и брандмауэр, дабы убедиться, что они не являются виновниками возникшей проблемы;
- Проверьте ваш компьютер на вирусы, возможно какие то вредоносные программы пытаются перехватить ваш трафик.
- Очистите кэш и куки вашего браузера.
Если проблема не на стороне клиента, то скорее всего проблема находится на самом сервере.
За максимальный размер передаваемого пакета отвечают три параметра в конфигурации nginx, которые нужно разместить в секции http:
- client_body_buffer_size — размер буфера для тела запроса;
- client_header_buffer_size — размер буфера для заголовка;
- large_client_header_buffers — максимальное количество и размер буфера для чтения большого заголовка.
Для того что бы устранить ее вам надо поправить настройки nginx’а:
http {
...
large_client_header_buffers 4 16k;
...
}
Мы установили 4 буфера размером 16Кб каждый (по умолчанию 8Кб или 4Кб)
Далее мы перегружаем nginx через команду: nginx -s reload
Однако если у вас на сервере так же установлен Apache, то может возникнуть еще одна ошибка: «Your browser sent a request that this server could not understand. Size of a request header field exceeds server limit.» Для того чтобы устранить ее нам нужно добавить в конфигурацию сайта следующий параметр:
LimitRequestFieldSize 16380
который так же отвечает за максимальный размер запроса который обработает Apache.
I am getting a 400 Bad Request request header or cookie too large from nginx with my Rails app. Restarting the browser fixes the issue. I am only storing a string id in my cookie so it should be tiny.
Where can I find the nginx error logs? I looked at nano /opt/nginx/logs/error.log, but it doesn’t have anything related.
I tried to set following and no luck:
location / {
large_client_header_buffers 4 32k;
proxy_buffer_size 32k;
}
nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
passenger_root /home/app/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19;
passenger_ruby /home/app/.rvm/wrappers/ruby-1.9.3-p392/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 20M;
server {
listen 80;
server_name localhost;
root /home/app/myapp/current/public;
passenger_enabled on;
#charset koi8-r;
#access_log logs/host.access.log main;
# location / {
# large_client_header_buffers 4 32k;
# proxy_buffer_size 32k;
# }
# location / {
# root html;
# index index.html index.htm;
# client_max_body_size 4M;
# client_body_buffer_size 128k;
# }
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ .php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Here’s my code storing the cookies and a screenshot of the cookies in Firebug. I used firebug to check stored session and I found New Relic and jQuery are storing cookies too; could this be why the cookie size is exceeded?
def current_company
return if current_user.nil?
session[:current_company_id] = current_user.companies.first.id if session[:current_company_id].blank?
@current_company ||= Company.find(session[:current_company_id])
end
If you are getting the Error 400 Bad Request: Request Header or Cookie too Large Issue issue while trying to access a website or even your own website, we are here to help you. In this article, we have compiled different solutions and workarounds that will help you completely rid yourself of this error.
Make sure to follow all the solutions that have been listed in this article and also read through the reasons due to which it occurs in the first place. Basically, some Nginx web servers are set up in such a way that they might not accept cookies that are greater than a certain size.
What Causes the 400 Bad Request Request Header or Cookie too Large Error?
After going through the mentioned solutions that the users have told us, we have concluded the reasons due to which the error might be triggered.
- Large Cookies: Sometimes, the cookies that you are trying to use with the website might be too large due to which the Bad Request Header or Cookie too large error might be triggered. Therefore, we suggest that you try and clear out the cookies in an attempt to fix the issue.
- DNS Cache: The DNS settings that you have configured with your computer might be preventing it from being able to connect with certain websites or the DNS cache stored might have been corrupted. Therefore, we suggest that you try and flush out the DNS cache.
- File Size: The File Size that you are trying to upload might be larger than the upload limit of the website. Therefore, we suggest that you try and reduce the file size or try to upload a different file with a size smaller than the one that you are trying to upload.
- Chrome Extensions: The extensions installed on your browser might be preventing the site from being accessed due to which the error is being triggered. Therefore, we suggest that you try and disable the extensions and then check to see if doing so fixes the error message.
Now that the reasons have been mentioned to you, you can finally start implementing the solutions and hopefully get rid of the error message on your PC.
Fixing the Bad Request Header or Cookie too Large Error:
Solution 1: Clear Cookies
This error can be instantly resolved by clearing cookies from your browser. Proceed with the steps listed below for clearing the cache in your respective browser:
Google Chrome:
- Launch Google Chrome and select the “Three Dots” on the top right side of the window.
- From the dropdown menu that appears, click on the “Settings” option.
- In the search bar type in “Site Settings” and open it.
Clicking on “Site Settings” - Navigate to “Content” and click on “Cookies and Site Data”.
- Afterwards, click on the “See all cookies and sites” option.
- Then click on “Remove All” to remove all of the cookies.
Clicking on the “Remove All” button - Finally, proceed to “Restart” the Chrome browser.
Firefox:
- Open Firefox on your desktop PC and click on the “Open Application Menu” option in the top-right corner.
- From here select “Options” from the drop-down menu and next click on “Privacy & Security” from the right window pane.
Clicking on “Options” in Firefox - Next under the “History” section click on the “Clear History” option.
- Lastly “Restart” Firefox and check to see if the error got solved.
Microsoft Edge:
- Open Microsoft Edge on your PC and click on the “Three Dots” in the upper right corner of the window.
- Click on the “Settings” option on the top right side and from the left, select the “Privacy, Search, and Services” option.
- On the Right, select the “Choose what to clear” option and select it.
- Check the “Cookies and saved website data” option and next click on “Clear”.
Clearing Microsoft Edge Cookies - Lastly, “Restart” the browser and check to see if the error got fixed.
Opera:
- Click on the “Opera” icon in the upper left corner of the window.
- Select the “Preferences” from the drop-down menu.
- Then select “Privacy and Security” and navigate to “Cookies”.
Clicking on the Privacy and Security option - Go to “All cookies and website data” and delete all cookies by clicking the “Delete All” option.
- Finally, “Restart” the browser.
Safari:
- Click on the “Safari” icon on the top left-hand corner of the window.
- From the dropdown menu, navigate to “Preferences” and click on it.
- Select the “Privacy” tab and click on “Remove all website data” in cookies to delete all cookies.
Selecting the Remove all Website Data option - Then “Restart” your browser.
Solution 2: Add Base URL to Clear Cookies
- Open “Google Chrome” and click on three vertical dots on the top right corner of the window.
- A dropdown menu will appear up, from here click on “Settings”.
- In the search bar type “Site Settings” and click to open it.
Selecting the “Site Settings” option - Click on the “Cookies and Site Data” option and scroll to the bottom.
- Click on “Add” which is next to the “Always Clear Cookies when Windows are Closed” option.
Clicking on the “Add” option - Enter the base “Web Address”, e.g. youtube.com. (A base address is one that is without any path or an address that leads you to the front page of the website).
- Finally, click on “Add”.
Solution 3: Verify the Entered URL
Sometimes the URL you type is also wrong. A few common mistakes are misspelling the site name or entering the backward slashes. One easier way is to use the URL shortener if you have a long URL and try to copy-paste the URL instead of typing it manually to avoid any mistake. Once you have cross-checked your URL, try to access the page again. If you are still getting the error then try other methods like clearing cookies or disabling extensions.
Solution 4: Flush the DNS Cache
- Go to the “Start menu” and type “cmd” in the search bar. From the search results right-click on it and select “Run As Administrator”.
Select Run As Administrator From The Command Prompt - Then type in the following command in the Command Prompt window and hit the “Enter” key:
ipconfig /flushdns
Flush DNS - After executing this command now “Restart” your computer and run Steam again.
Solution 5: Compress the File Size
If you try to upload a file that is larger than the server limit, it is quite likely that you can face this error. You can check this by uploading a smaller file and if it uploads successfully then you might have to compress your file to avoid server limitation issues.
Solution 6: Wait Until the Server Is Being Fixed
This error can also occur due to server-side issues which are out of your control. It might be a server glitch or the server might be being updated. In such a scenario all you can do is to refresh the page and wait till servers are up again. Just refresh the page on a regular interval and check if the server has been fixed and the Header or Cookie too Large error is gone or not.
Solution 7: Disable Chrome Extensions
- Launch “Chrome” on your PC, and then click on the “Three vertical dots” in the top right of the window.
- From the drop-down menu click to select the “More Tools” option.
More Tools - Next click to select “Extensions” from the extended menu.
- Once inside the Extensions tab “Disable” all of the extensions one by one, if successful in removing the error you can try enabling the extensions one by one afterwards to find out the problematic one.
- Add the “large_client_header_buffers 4 16k” directive to the “HTTP” section of “/etc/nginx.conf file”.
- Then reload the Nginx process by entering the following command:
sudo nginx -t && sudo service nginx reload
- If this doesn’t work then double the value of the second parameter of the “large_client_header_buffers” directive and reload Nginx.
- Check to see if doing so fixes the Header or Cookie too Large error.
Solution 9: Use Direct Connection Mode With TCP
Convert the application to use the “Direct connection mode” with the Transmission Control Protocol or TCP. After doing this the issue would not arise because this direct connection mode with the TCP does not have a header size restriction like the HTTP protocol. Use the latest version of SDK that has a fix for query operations when the service interop isn’t available. You can learn more about it in .NET v3 or .NET v2 performance tips articles.
If you can’t go for the direct connection with the TCP then change the client consistency level to lighten the problem. The session token is only used for session consistency, other consistency levels do not use the session token.
Implement the above-indexed methods carefully in order to avoid getting the Header or Cookie too Large error in the future but if you still have any more questions in this regard then feel free to Contact Us here.
При переходе на какую-либо интернет-страницу пользователь может столкнуться с невозможностью открытия данной страницы, и соответствующими сообщениями «400 Bad request» и 504 Gateway Time-out. Последнее обычно указывает на наличие в пользовательской интернет-ссылке синтаксических ошибок, а также на возможные проблемы в работе провайдера и пользовательского ПК. В данном материале я расскажу, что такое Bad request 400, каковы причины данной дисфункции, и поделюсь инструкцией по её исправлению.
Содержание
- Что значит 400 Bad Request и каковы его причины
- Как исправить ошибку 400
- Что это 400 Bad Request Request Header Or Cookie Too Large nginx?
- Заключение
Что значит 400 Bad Request и каковы его причины
В переводе с английского языка текст данного сообщения звучит как «400 плохой запрос», и обычно обозначает ситуацию, при которой пользователь использовал неправильный синтаксис при обращении к какому-либо сетевому ресурсу.
Проще говоря, пользовательский запрос, который был отправлен на какой-либо сервер (часто это тривиальный запрос на загрузку интернет-страницы), был некорректен или повреждён, и сервер не смог распознать его.
Причины появления 400 Bad request могут быть следующими:
- Пользователь использовал некорректный текст ссылки (недостающие или лишние символы, пробелы и т.д.);
- Куки пользовательского браузера повреждены;
- Наблюдаются проблемы в работе провайдера (ISP);
- Имеются проблемы с пользовательским подключением к Интернету;
- Корректное подключение к интернету блокируют антивирус или брандмауэр;
- Имеются проблемы в работе DNS;
- Злокачественная деятельность вирусных программ блокирует доступ к нужному сайту.
После того, как мы разобрались с тем, что означает 400 bad request необходимо приступать к её устранению.
Как исправить ошибку 400
Чтобы избавиться от ошибки выполните следующее:
- Внимательно проверьте используемую вами интернет-ссылку на наличие ошибок (лишние или недостающие символы, пробелы, неиспользуемые символы типа % и др.). Введите корректную ссылку и повторите запрос;
Проверьте правильность ссылки в адресной строке вашего браузера - Очистите кэш и куки вашего браузера. К примеру, в Мозилле это делается путём перехода в «Настройки» — «Приватность», и удалением истории после закрытия браузера (кэш и куки будут удалены). Поскольку многие сайты выдают ошибку 400 когда их куки повреждены или устарели, то очистка куки поможет устранить ошибку 400 Bad request;
- Очистите кэш DNS. Для этого откройте командную строку от имени администратора, в ней введите: ipconfig /flushdns и нажмите ввод;
- Временно отключите ваш антивирус и брандмауэр. Последние могут блокировать доступ к нужному сайту, и их временная деактивация поможет в решении проблемы ошибки 400;
- Защитите свой ПК от вирусов с помощью 3 практических советов и проверьте ваш компьютер на наличие вирусов онлайн. Помогут такие инструменты как «Dr.Web CureIt!», «Trojan Remover», «AdwCleaner» и другие аналоги;
- Если вы получили ошибку 400 во время загрузки какого-либо файла на сервер, то это может означать, что данный файл слишком большой, и сервер не принимает его;
- Если ошибка 400 случается практически на каждом сайте, тогда, вполне возможно, имеются проблемы у вашего провайдера, или с вашим интернет-соединением. Проверьте скорость вашего интернета (помогут сетевые тесты скорости уровня «Speedtest.net»), а также уточните у провайдера, не ведутся ли у него какие-либо технические работы;
Используйте сетевые сервисы уровня speedtest.net для проверки скорости вашего интернета - Попробуйте обратиться к нужному сайту напрямую (то есть, к примеру, вместо otvet.mail.ru/?fr=mailrufm=2 обратитесь напрямую к www.mail.ru). Возможно, с конкретной страницей у сайта наблюдаются проблемы, и будет не лишним сообщить о них администрации ресурса;
- Просто подождите. Возможно, на сайте наблюдаются технические проблемы, и вскоре они будут решены.
Также ряд пользователей может встретиться с ошибкой «Request Header Or Cookie Too Large nginx», которая обычно возникает при просмотре видео на каких-либо сетевых ресурсах.
Как указано в тексте самой ошибки, данная проблема обычно связана с повреждёнными куками на компьютере пользователя. Для её решения будет достаточно перейти в настройки вашего браузера, очистить кэш и куки, а затем и перезапустить сам браузер. После этого проблема обычно бывает решена.
Заключение
Мы рассмотрели, что такое 400 Bad request, каковы причины появления данной дисфункции, и как её исправить. В большинстве случаев фактором возникновения данной проблемы является некорректный текст ссылки, введённой пользователем в адресной строке браузера. Решением проблемы станет выполнение перечисленных мной советов, они помогут исправить ошибку на вашем ПК.
Опубликовано 05.09.2017 Обновлено 04.11.2020
-
MiniTool
-
MiniTool News Center
- How to Fix the “Request Header Or Cookie Too Large” Issue
By Daisy | Follow |
Last Updated May 31, 2021
When you visit a website on Google Chrome, IE, Firefox, Microsoft Edge, you may receive the “Request Header Or Cookie Too Large” error message. When you receive it, you can read this post from MiniTool to find some useful methods to get rid of it.
Maybe you have received the “400 Bad Request. Request Header or Cookie Too Large» error message. The Nginx web server is the sculpt. Sometimes, websites that use the software do not allow the use of browser cookies of a certain size, or the cookie stored in the browser may be corrupted. Now, let’s see how to fix the “cookie too big” issue.
For Google Chrome
If you are a Google Chrome user, you can refer to this part. You can fix the “ 400 Bad Request. Request Header Or Cookie Too Large” by checking and deleting the cookies of that particular domain in the cookie section of the Chrome. Here are the details.
Step 1: Open Google Chrome and click the Settings option.
Step 2: Navigate to the Privacy and security part and click the Site settings option.
Step 3: Click Cookies and site data and click See all cookies and site data. Then, click the Remove All option.
Then, you can check if the “Request Header Or Cookie Too Large” has been fixed.
Also see: How to Clear Cookies on Chrome, Firefox and Edge
For Internet Explorer
If you are a Internrt Exporer user, you can read this part. Now, follow the steps below to fix the “request header too large” issue.
Step 1: Click the Settings icon and select Internet options from the drop-down menu.
Step 2: Navigate to the General tab and go to the Browsing History part. Then click Settings and click View files.
Now search the folder you just opened in File Explorer for the site in question. Then delete the cookies. Then, check to see if the “cookie too big” issue has gone.
For Firefox
If you are a Firefox user, the content in this part is what you need. The solution is the same, that is to say, you need to remove the cache files of that particular website to fix the “Request Header Or Cookie Too Large” issue. Here is how to do that:
Step 1: Open Firefox and click the Options. Then, click the Privacy option.
Step 2: Select History and click the Remove individual cookies option. Now search for the website which is troubling you and delete the cookies related to it.
Step 3: Restart Firefox to check if the “Request Header Or Cookie Too Large” has been fixed.
Also see: Firefox Not Responding? Here Are 4 Effective Fixes for You
For Microsoft Edge
If you are the Microsoft Edge user, you can read this part. Now, the steps are as follows:
Step 1: Click the three horizontal dots in the upper right-hand corner.
Step 2: Now, click the Privacy & Security tab. Go to the Choose what to clear part and click choose what to clear option. Check the Cookies and saved website data option.
Step 3: Now click Clear. Then, restart the browser and check to see if the issue has been fixed.
Final Words
From this post, you can know how to fix the “Request Header Or Cookie Too Large” issue on Google Chrome, IE, Firefox, Microsoft Edge. If you encounter the same issue, you can refer to this post. If you have any better ideas to fix the error, you can share it in the comment zone.
About The Author
Position: Columnist
She was graduated from the major in English. She has been the MiniTool editor since she was graduated from university. She specializes in writing articles about backing up data & systems, cloning disks, and syncing files, etc. She is also good at writing articles about computer knowledge and computer issues. In daily life, she likes running and going to the amusement park with friends to play some exciting items.
We open many websites at one time on our browser to search for something on the internet. There are some websites that we check daily; it can be a news site, your work login, or something else. If such important websites show errors like ‘400 Bad Request, Request Header or Cookie Too Large,’ it can get frustrating.
At times, you will see the same error on all the different browsers available on your computer for a specific website only. Let’s get started on what this error is and how to eliminate it to enjoy browsing again.
The ‘request header too large’ error message can be seen on any website for two main reasons. One reason is that the size of the cookie for that particular domain is too large, and therefore the server refuses to display the website. Another reason for the ‘400 Bad Request, Request Header or Cookie Too Large’ error message is corrupted cookies.
Well, you can experience this error on Google Chrome, Microsoft Edge, Mozilla Firefox, or any other browser. This error happens mostly on the sites that are running on the Nginx server.
How To Fix Request Header Or Cookie Too Large Error
You can clear cookies and cache for that particular website to fix this 400 bad request error on your browser.
Note: The solutions are suggested with regard to different famous browsers. You can jump to the web browser section you are currently using and understand how to fix request header or cookie too large.
Google Chrome
There are two ways to reach the cookie settings. You can open the new tab in the browser and type –
chrome://settings/cookies
If you don’t want to go the direct way, follow steps 1 to 3 below. You need to follow instructions from step 4, irrespective of what way you choose to reach the cookie settings page.
Step 1: Open Google Chrome browser and click on the 3 dots in the upper right corner of the browser window. Select Settings from the menu.
Step 2: In the Settings tab, scroll down to Privacy and security and click on the arrow next to Site Settings.
Step 3: Now, click on Cookies and site data under the Content section.
Step 4: Click on the arrow next to See all cookies and site data on the next screen.
Step 5: You can either delete all the cookies by clicking on the Remove All option or delete the cookie of the affected website by clicking on the delete icon next to it.
If you don’t find the problematic web page easily, you can search for it in the search bar.
Once the cookies are deleted, you can relaunch the browser. In the browser, check if you can access the website giving ‘400 Bad Request, Request Header or Cookie Too Large’ errors or not.
Microsoft Edge
Microsoft Edge does not allow you to clear cookies for a single website. You need to clear cookies and site data for all the websites. There is a timestamp option available which allows you to remove browser cookies for a specific time frame.
Open the Microsoft Edge browser and click on the 3 dots in the top right corner of the browser. Click on the Settings from the menu.
In the Settings tab, click on Privacy, search, and services from the left tab.
Next, scroll down to the Clear browsing data section and click on the Choose what to clear button.
Select the Time range; if you wish to avoid deleting all cookies, select the Last hour option. Also, check the checkbox next to Cookies and other site data.
Click on the Clear now button.
Close the Microsoft Edge browser and open it again. Once opened, try accessing the website that was giving an error. If corrupted cookies were a problem, you would be able to access the website again on the browser without a request header or cookie too large error message.
Mozilla Firefox
If you are Mozilla Firefox, you can get rid of cookies from a problematic website easily.
Step 1: Open the Mozilla Firefox browser on your computer and click on 3 lines in the upper right corner. Select Settings from the menu.
Step 2: From the Settings tab, click on Privacy & Security.
Step 3: Now, scroll down to Cookies and Site Data and click on the Manage Data option.
Step 4: In Manage Cookies and Site Data window, select the website that was giving 400 Bad Request, Request Header or Cookie Too Large error, and click on Remove Selected.
Make sure you don’t click on Remove All; it will remove cookies and cache from all websites you have browsed.
Opera Browser
If you are a fan of Opera browser, you would like to know how to get rid of the Request Header or Cookie Too Large error in Opera.
Launch the Opera browser and Easy setup option (3 lines) in the top right corner. Click on Go to full browser settings seen at the end of the menu.
Next, expand the Advanced section and click on Privacy & security.
Now, open the Site Settings
In the Site Settings, click on the arrow next to the Cookies and site data under Content.
Scroll down and click on See all cookies and site data
Click on the delete icon next to the website that was showing the 400 Bad Request error. You can search for that website in the search box if you don’t find it easily.
You can relaunch the browser and try opening the website again.
Internet Explorer
Although Internet Explorer is not used much nowadays, some people rely on it for work purposes. Know how to clear cookies and get rid of the 400 Bad Request, Request Header or Cookie Too Large error message.
Open Internet Explorer and click on the Settings gear in the top right corner of the browser. Select Internet options from the Settings menu.
In the Internet options dialog box, click on the General tab and then click on the Settings button under Browsing history.
Now, under the Temporary Internet Files tab, click on the View files button.
The File Explorer window will open, and you will see files with the website name. You can delete the file that has the affected website name. Make sure you press the Shift + Delete keys to delete that file from your computer permanently.
Now, relaunch the Internet Explorer and browse the website that was giving errors before.
Use Third-party Application
Some people use multiple browsers to keep their work and entertainment tabs separated. Well, in such a case, deleting cookies from each of the browsers can be tedious work. You need to launch and relaunch all the browsers just to clear cookies for one particular website.
For such a user, we recommend using a third party tool called CookieSpy. It is a free tool that allows you to view and delete cookies from multiple browsers in one window. The currently supported browsers are Google Chrome, Mozilla Firefox, Apple Safari, Internet Explorer, and Opera.
CookieSpy can be used only to view and delete cookies. It does not support any other feature than that. This makes it convenient for people who want an app just to clear cookies from different browsers.
When you install CookieSpy, it will detect all the browsers on your computer and have tabs for all the different browsers showing saved cookies. You can delete cookies for any site on any browser from the CookieSpy window.
Download CookieSpy
Conclusion
The 400 error can be seen anywhere while you use the browser. It can get extremely annoying when you are not able to access important work-related websites. The website itself can resolve the 400 Bad Request, Request Header or Cookie Too Large error message in a few minutes if the error is from their end because of cookie size.
However, if the error is because of corrupt cookies in your browser, the only way to fix the 400 Bad Request error message is to clear cookies for that website. You can easily clear cookies from Google Chrome, Microsoft Edge, Mozilla Firefox, and Opera Browser. But when it comes to Internet Explorer, you need to delete it via File Explorer.
The process of clearing cookies for Internet Explorer via File Explorer is mentioned above, but we recommend switching from Internet Explorer to a different browser, as Microsoft is ending support for Internet Explorer from August 2021.
400 Bad Request. Request header or cookie too large is one such error which we get during browsing. For now, we will be talking about the Fix on every popular browser. Yes, it’s common in all browsers.
No Need to mention that the internet is widely used in our daily life. However, there might need to come across many websites in daily life for some information or so. what if it returns an error? Horrible right? Returning some error like no internet etc hesitate users.
Table of Contents
This is generally caused by Nginx web server mainly for 2 reasons.
- Cookies stored might be corrupted.
- Sometimes websites which you visit might uses software which doesn’t allow cookie over a particular size.
How to Fix Error 400 Bad Request?
And Yes, Clearing all cookies from your browser will do the work for you by loosing all the existing cookies which might include logins. So I personally prefer to delete the particular cookies and following are the solutions.
Video Tutorial:
We provided this article in the form of a video Tutorial for our reader’s convenience. If you are interested in reading, then continue and watch it after completion.
1.400 Bad Request Fix in chrome
It’s simple. One just needs to check and delete the cookies of that particular domain in the cookie section of the Chrome. Here it is,
- Open Google Chrome and Head on to the settings.
- Scroll down and click Advanced.
- Open “Site settings”.
- Open Cookies->All Cookies Data
- Delete the cookies related to the website which shows you the error.
Just Restart the Google Chrome Browser and visit the website which troubled you.
- Related: 2 Ways to Clear cookies for one specific site in Google Chrome
- 3 Ways to recover deleted Google chrome history
- 7 Simple Tips to increase Google chrome speed
2. How do I fix bad request request too long In Firefox
Firefox browser is not an exception for this error. The solution is same i.e removing the cache files of that particular website. However, the settings might differ a bit. Here is the complete process to do so,
- Open Firefox Browser
- Click on Options and then Privacy.
- Select History and click on Remove individual cookies.
- Now search for the website which is troubling you and delete the cookies related to it.
- Close the browser and Open the website.
- Also Read: 2 Ways to clear Cookies for a specific site in Firefox
- 4 Simple tips to increase Firefox Speed
3. Error 400 bad request fix In Microsoft Edge
By keeping the features in Mind, Chrome and Firefox are widely used. Not to forget, Microsoft done great improvements to its Browser and is in the race. But we can’t delete the cookies of a particular website/domain as we do above. Only thing is to clear all browsing history. Yes, it irritates sometimes.
Just go to history and tick the required options like as below.
To be frank, I won’t recommend deleting history every time unless you are a fan of edge.
- Related: How to change the default search engine to Goole in Microsoft edge
Till now I had covered solution for popular browsers. Some might be lazy to clear cookies every time. For them, there are a lot of third-party tools through which you can manage the cookies of all browsers at a single place. Yes, it surely helps people who use multiple browsers. One of such kind is Cookiespy.
Hope I had covered each and everything regarding Cookie too large error. Feel free to ask your queries in the comment section.
If you like this tutorial about the error 400 bad request fix, please share it and follow whatvwant on Facebook, Twitter, and YouTube for more tips.
This article describes steps one can take to resolve Nginx 400 Bad Request Header or Cookies error.
I run some of my websites via Nginx HTTP servers and some of my Nginx configurations are configured for different environments. So, when I got this error message (400 Bad Request: Request Header or Cookie Too Large) while working on one of my servers, I quickly did some research and resolve it.
If you find yourself in a similar situation, follow the steps below to get it resolved quickly.
Oh, by the way, this could also be your browser is sending a very large cookie and the server is refusing to serve the page. In addition to a browser sending large cookies, it could also be an Nginx configuration issue, and adjusting Nginx’s buffer size to accommodate large cookies could help.
If you don’t want to clear your browser cookies or reset them, then follow the steps below to adjust the Nginx configuration to allow large cookies.
When you see this error message it means a header or some of the headers sent to Nginx is too large and well over the configuration limit, and Nginx is rejecting it. To get it resolved, follow the steps below:
oh, just so you know, the default buffer number and size for Nginx are 4 and 8k.
If a header size is above the limit above, you’ll get that error message.
On the Nginx HTTP server, open the server configuration file.
sudo nano /etc/nginx/sites-available/example.com.conf
The location of your server configuration file may differ from the above. When the file opens, add this line of configuration and save.
server {
# .
large_client_header_buffers 4 16k;
# .
}
Save the file and exit
The Nginx states that the line is only valid in HTTP or server contexts. so make sure you add the configuration line or context. After that, restart or reload the Nginx server.
sudo systemctl reload nginx.service
Test again and the error should be gone.
If you’re still getting the error after restarting, bump the number to 4 and 32k. then restart the Nginx server.
Another thing to look at is if you’re running an Nginx proxy with proxy_set_header config, you should simply remove that line from your proxy configuration block.
For example, remove the line below from your proxy configuration block if you have it configured, then save and restart Nginx.
proxy_set_header Host app.example.com;
These steps above should get you back to a functioning site.
If all the steps above don’t work, there may be other issues in play there. clear your browser’s cookies and maybe reset your browser by deleting all data stored in it, hopefully, it should work.
Request Header or Cookie Too Large is an error that typically appears when you open a website on your browser for browsing or searching something. The error presents itself with the short message on the screen ‘400 Bad Request, Request Header or Cookie Too Large,’ The Nginx web server is the sculpt.
This is annoying as you can’t visit a particular website and the error is not limited to any particular browser. As per the reports, it is seen the error appears on different browsers like Google Chrome, Microsoft Edge, Internet Explorer, Opera, Mozilla Firefox when visiting the particular website.
After investigating this random we find out this type of error is related to the browser issues or some sort of corruption. Luckily this is not a big hurdle some ways help you to fix the error easily.
But first, it is important to understand the common culprits that may trigger this annoying error.
- Nginx web server – The websites that are typically running on the Nginx server are showing the error. This won’t allow the browser cookies over a particular size and due to this, the server refuses to show the website. To fix it delete all the cookies and try visiting the particular website.
- Cookies too large or corrupted – another possible reason why you are seeing the error on your screen is the cookies for the particular website is too large or the cookies gets corrupted. Clearing the cache data and cookies may work for you.
As you are now aware of the reasons that trigger the error now follow the fixes given to troubleshoot the 400 Bad Request, Request Header or Cookie Too Large error and visit the website without any issue.
Preliminary Fixes
Sometimes some temporary network glitches or bugs cause problems and start showing errors. So, before heading towards the detailed fixes it is suggested to follow the easy tweaks and check if the error is fixed.
Force reloads the page – Try force reloading the webpage by pressing the CTRL + F5 key a couple of times on your Windows system. And Command+Shift+R keys if using the Mac system. And check if this work for you, if not then try the next quick tweak.
Open website in the private browser – If reloading the page won’t work for you then try opening the particular website in the private window of your browser. In Chrome open the Incognito Window, in Firefox open the Private Browsing Window in Internet Explorer open the InPrivate Browsing Window and for Safari browser open Private Window, and open the particular website.
Now check if the error is solved, but if still unable to visit the website and get the error on your screen then follow the next fix as per your browser.
Clear Cookies Stored in the Browser
Another best solution is deleting entire cookies for that site or in your cache. The stored cache gets corrupted after some time and stops you from visiting a particular website.
Also, many users confirmed that clearing the cookies worked for them to fix the 400 Bad Request. Request Header or Cookie Too Large error in the browser.
Please Note: The steps suggested are for different preferred browsers. So directly head to the browser you are using currently and fix the error.
For Google Chrome Browser:
Here follow the steps to disable cookies in the Google Chrome browser:
- Start the Chrome browser and then tap on the three dots icon on the top right side of the browser.
- Then from the main menu choose Settings and then go to the Privacy and Security option
Open the Chrome Settings - And then next to settings click on the arrow
- Next under the options Content section click the Cookies and other site data option.
Cookies and Other Site Data - Then checkmark the box next to the option See all cookies and site data
- Here either delete entire cookies by choosing the Remove All or delete one of the particular sites by clicking the delete icon in front of it.
Remove the Google Cookies from Chrome
However, if you won’t locate the problematic website cookies then consider searching for them in the search option.
And as the cookies are cleared, restart the chrome browser and visit the particular browser to see, if you can visit the webpage without seeing the error.
For Mozilla Firefox Browser:
If you are using the Mozilla Firefox browser then below follow the steps to remove or delete the cookies from the problematic site:
Follow the instructions given to do so:
- Launch the Mozilla Firefox browser and then in the upper right corner click on 3 then from the menu option choose Settings.
- And from the Settings tab, choose the option Privacy & Security.
Choose Privacy & Security in Firefox - Then scroll to find the Cookies and Site Data option and choose on Manage Data option
Open Manage Data on Firefox - Next to the Manage Cookies and Site Data window, choose the particular website showing the error, then click on Remove Selected option.
Remove Cookies For Affected Website - Or else if you want then click on the Remove All option for removing cookies and cache from entire browsed websites.
As the steps are completed then restart the Firefox browser and visit the particular website to see if the error is fixed.
For Microsoft Edge Browser
Now if you are using the Microsoft Edge browser, then follow the steps to delete cookies. But before starting with the steps, you should know that Edge browsers won’t allow the users to remove cookies for the particular website.
This browser users need to remove entire cookies and sites. Also, you will get the timestamp option that allows the users to clear cookies for a particular time range, you can set the timestamp accordingly.
Now follow the instructions given to do so:
- Launch the Edge browser and at the upper right corner click on 3 dots, on your browser then from the main menu option choose Settings.
Opening Microsoft Edge settings - And next in the Settings window, from the left side choose Privacy, search, & services
- Then scroll to find the option Clear browsing data and tap on Choose what to clear button.
Click On Choose What To Clear in Edge - Next, choose the Time range; in case you don’t want to delete all cookies, choose the option Last hour. And checkmark the box next to the Cookies and other site data.
- And then click the Clear now option
Click On The Clear Now Button in Edge
Next, close your Edge browser and launch it again. Try visiting the specific website causing the error and check if you can visit the web page without seeing the error message.
For Opera Browser
If you are an Opera browser user and see the error Request Header or Cookie Too Large error when visiting a website then clearing the cookies may help you out.
Follow the instruction to clear cookies on Opera:
- Start the browser and in the above right side, go to the3 lines and click on it then in the menu scroll down to the Go to full browser settings
- And click to enlarge the option Advanced section then click on the option Privacy & Security and launch the Site Settings.
Open The Site Settings in the Opera browser - Then under the Content, option-click on the arrow icon next to the option Cookies and site data.
Open Cookies And Site Data In the Opera browser - Then scroll to find and choose the See all cookies and site data option, click the remove icon in front of the problematic website showing the error.
Click on the See All Cookies And Site Data option - Alternatively, if you won’t find it then search for the affected website in the search box
Restart the browser, visit the website and check if you see the error or is fixed.
For Internet Explorer Browser
Well nowadays the internet explorer browser is not utilized considerably, but still, some users rely on it for some sort of work. So, if you see 400 Bad Request errors, then clear the cookies on your IE browser.
Follow the instructions given:
- Launch the Internet Explorer browser and then at the upper right corner click on the Settings gear and from the Settings option choose the Internet options.
Choose the Internet options in Internet Explorer - Then tap on the General window and under the Browsing History option click on the Settings button.
Click On Settings option - Next under the Temporary Internet Files option click on the button View files.
Click On View Files option in IE - Now the File Explorer window starts and here locate the affected website name then clear the file having the problematic website name.
- Hit the Shift + delete keys from deleting the files from the system permanently.
Now restart the Internet Explorer, try visiting the website to see if the error still appears or is fixed completely.
It is estimated the given solutions works for you to rectify the 400 Bad Request. Request Header or Cookie Too Large error in your browser. But if still see the error, then switch to a different browser or reinstall your browser. Also if the error is not with your browser then wait for the website to change the server or fix the error.