大家好,又见面了,我是你们的朋友全栈君。
400错误请求怎么解决
A 400 Bad Request Error occurs when a request sent to the website server is incorrect or corrupt, and the server receiving the request can’t understand it. Occasionally, the problem is on the website itself, and there’s not much you can do about that. But most of the time, the problem is one you might be able to solve—maybe you typed the address wrong, or maybe your browser cache is causing problems. Here are some solutions you can try.
当发送到网站服务器的请求不正确或损坏,并且接收到该请求的服务器无法理解时,就会发生400错误请求错误。 有时,问题出在网站本身上,您对此无能为力。 但是在大多数情况下,问题是您可能可以解决的问题-也许您输入的地址错误,或者浏览器缓存导致了问题。 您可以尝试以下解决方案。
A 400 Bad Request error happens when a server cannot understand a request that’s been made of it. It’s called a 400 error because that’s the HTTP status code that the web server uses to describe that kind of error.
当服务器无法理解对它的请求时,会发生400 Bad Request错误。 之所以称为400错误,是因为这是Web服务器用来描述这种错误的HTTP状态代码。
A 400 Bad Request error can happen because there’s a simple error in the request. Perhaps you’ve mistyped a URL and the server can’t return a 404 Error, for some reason. Or maybe your web browser is trying to use an expired or invalid cookie. Some servers that are not configured properly can also throw 400 errors instead of more helpful errors in some situations. For example, when you try to upload a file that’s too big to some sites, you might get a 400 error instead of an error letting you know about the maximum file size.
可能会发生400错误的请求错误,因为请求中有一个简单的错误。 也许您输入了错误的URL,并且服务器由于某种原因无法返回404错误。 也许您的Web浏览器正在尝试使用过期或无效的cookie 。 在某些情况下,某些未正确配置的服务器也可能引发400错误,而不是更多有用的错误。 例如,当您尝试上传对某些站点太大的文件时,可能会显示400错误,而不是让您知道最大文件大小的错误。
Just like with 404 errors and 502 errors, website designers can customize how a 400 error looks. So, you might see different looking 400 pages on different websites. Websites might also use slightly different names for this error. For example, you might see things like:
就像404错误和502错误一样,网站设计者可以自定义400错误的外观。 因此,您可能会在不同的网站上看到外观不同的400页。 网站可能还会对此错误使用稍微不同的名称。 例如,您可能会看到以下内容:
Often, you can do something to fix getting a 400 error, but figuring out exactly what can be challenging because of the vague nature of the error. Here are some things you can try.
通常,您可以采取一些措施来解决出现400错误的问题,但是由于错误的含糊性质,您可以准确地找出可能具有挑战性的内容。 您可以尝试以下方法。
Refreshing the page is always worth a shot. Many times the 400 error is temporary, and a simple refresh might do the trick. Most browsers use the F5 key to refresh, and also provide a Refresh button somewhere on the address bar. It doesn’t fix the problem very often, but it takes just a second to try.
刷新页面始终值得一试。 很多时候,400错误是暂时的,只需刷新即可解决问题。 大多数浏览器使用F5键刷新,并在地址栏上的某个位置提供“刷新”按钮。 它不会经常解决问题,但是只需一秒钟即可尝试。
The most common reason for a 400 error is a mistyped URL. If you typed a URL into your address box yourself, it’s possible you mistyped. If you clicked a link on another web page and were shown a 404 error, it’s also possible that the link was mistyped on the linking page. Check the address and see if you spot any obvious errors. Also, check for special symbols in the URL, especially ones that you don’t see in URLs often.
出现400错误的最常见原因是网址输入错误。 如果您自己在地址栏中输入了URL,则可能输入错误。 如果单击另一个网页上的链接并显示404错误,则也有可能在链接页面上键入了错误的链接。 检查地址,看看是否发现任何明显的错误。 另外,请检查URL中的特殊符号,尤其是您在URL中通常看不到的特殊符号。
If the URL you are trying to reach is descriptive (or if you know roughly the name of the article or page you were expecting), you can use the keywords in the address to search the website. In the example below, you can’t really tell from the URL itself if anything is mistyped, but you can see some words from the name of the article.
如果您尝试访问的URL是描述性的(或者您大致了解所期望的文章或页面的名称),则可以使用地址中的关键字搜索网站。 在下面的示例中,您无法真正从URL本身判断出是否输错了任何内容,但是可以从文章名称中看到一些单词。
Armed with that knowledge, you can perform a search on the website with the relevant keywords.
有了这些知识,您就可以使用相关的关键字在网站上进行搜索。
That should lead you to the correct page.
那应该引导您到正确的页面。
The same solution also works if the website you are trying to reach changed the URL for some reason and did not redirect the old address to the new one.
如果您尝试访问的网站由于某种原因更改了URL并且未将旧地址重定向到新地址,则相同的解决方案也可以使用。
And if the website you’re on doesn’t have it’s own search box, you can always use Google (or whatever search engine you prefer). Just use the “site:” operator to search only the website in question for the keywords.
而且,如果您所在的网站没有它自己的搜索框,则可以随时使用Google(或您喜欢的任何搜索引擎)。 只需使用“ site:”运算符即可仅在相关网站中搜索关键字。
In the image below, we’re using Google and the search phrase “site:howtogeek.com focal length” to search just the howtogeek.com site for the keywords.
在下图中,我们使用Google和搜索词组“ site:howtogeek.com焦距”来仅搜索howtogeek.com网站中的关键字。
Many websites (including Google and YouTube) report a 400 error because the cookies they are reading are either corrupt or too old. Some browser extensions can also change your cookies and cause 400 errors. It’s also possible that your browser has cached a corrupt version of the page you’re trying to open.
许多网站(包括Google和YouTube)报告400错误,因为它们正在读取的Cookie损坏或过旧。 某些浏览器扩展程序也可能会更改Cookie,并导致400错误。 您的浏览器也可能缓存了您试图打开的页面的损坏版本。
To test out this possibility, you’ll have to clear your browser cache and cookies. Clearing the cache won’t affect your browsing experience much, but some websites may a take a couple of extra seconds to load as they re-download all the previously cached data. Clearing cookies means you’ll have to sign in again to most websites.
为了测试这种可能性,您必须清除浏览器缓存和cookie。 清除缓存不会对您的浏览体验造成太大影响,但是某些网站在重新下载所有先前缓存的数据时可能会花费额外的几秒钟时间。 清除Cookie意味着您将不得不再次登录大多数网站。
To clear the cache in your browser, you can follow this extensive guide which will teach you how to clear your cache on all the popular desktop and mobile browsers.
要清除浏览器中的缓存,您可以按照这份详尽的指南进行操作,该指南将教您如何清除所有流行的台式机和移动浏览器上的缓存。
Your computer might be storing outdated DNS records that are causing the errors. A simple flushing of your DNS records might help solve the problem. It’s easy to do, and won’t cause any problems to try. We’ve got full guides on how to reset your DNS cache on both Windows and macOS.
您的计算机可能正在存储导致错误的过时DNS记录。 简单刷新DNS记录可能有助于解决问题。 这很容易做到,并且不会引起任何问题。 我们已获得有关如何在Windows和macOS上重置DNS缓存的完整指南。
If you’re uploading a file to a website and that is when you are getting a 400 error, then the chances are that the file is too big. Try to upload a smaller file to confirm if this is causing the issue.
如果您正在将文件上传到网站,也就是当您遇到400错误时,则可能是文件太大。 尝试上传较小的文件,以确认是否是引起此问题的原因。
If you’ve been trying to open a single website and getting 400 errors, you should try to open other websites to see if the problem persists. If it does, it might be a problem with your computer or networking equipment rather than the website you’re trying to open.
如果您一直试图打开一个网站并遇到400个错误,则应尝试打开其他网站以查看问题是否仍然存在。 如果是这样,则可能是您的计算机或网络设备有问题,而不是您要打开的网站。
This solution is a hit and miss, but restarting your computer and especially your networking equipment (routers, modems) is a common way to get rid of a lot of server errors.
该解决方案是一个偶然的选择,但是重新启动计算机,尤其是重新启动网络设备(路由器,调制解调器)是摆脱许多服务器错误的常用方法。
If you’ve tried all the solutions and the error doesn’t seem to go away, then the website itself might be having a problem. Try to contact the website through a contact us page (if that works) or through social media. Chances are, they are already aware of the problem and working on fixing it.
如果您尝试了所有解决方案,但错误似乎并未消除,则网站本身可能有问题。 尝试通过“联系我们”页面(如果可行)或通过社交媒体与网站联系。 他们很可能已经意识到了这个问题,并正在努力解决。
翻译自: https://www.howtogeek.com/359267/what-is-a-400-bad-request-error-and-how-can-i-fix-it/
400错误请求怎么解决
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/187858.html原文链接:https://javaforall.cn