HTTP ERROR 431完美解决

8 篇文章 0 订阅

这个错误码感觉挺神奇的,很少有听过这个错误。记录下几个排查的步骤。

简单介绍下这个错误的说明:
Request Header Fields Too Large (请求头字段太大)

某些情况下,客户端发送 HTTP 请求头会变得很大,那么服务器可发送 431 Request Header Fields Too Large 来指明该问题。

正文

先来说一下我解决的方案:
域名问题:
修改前端vue.config.js

proxy: {
	target : `http://127.0.0.1:8080`
}

域名后面需要增加端口号,端口号根据服务来自己改。
因为大部分项目是通过nginx代理了,所以线上的服务器是不需要。本地根据自己的需要修改。

如果这个没有问题,下面是其他方法:

方案一

在SpringBoot项目中找到yml文件

server:
  port: 8090
  tomcat:
    max-swallow-size: -1
  max-http-header-size: 2MB

在后面追加max-http-header-size,注意是在server下面,不是tomcat。

方案二

排查Nginx配置文件:nginx.conf

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    
    client_header_buffer_size 10240k;
    large_client_header_buffers 6 10240k; 

}

检查最后两行代码,看是否存在,加上就可以。

方案三

前端vue.config.js注意代理问题

pathRewrite: {
  ['^' + process.env.VUE_APP_BASE_API]: ''
}

检查反斜杠

方案四

清空浏览器的cookie缓存重新加载。

以上就是这个问题的解决方法。如果有补充的希望大家评论告知。

补充一点,这个错误后端会报:
druid的错误,大家可以修改版本号为:1.2.1 来尝试解决。

以上就是http errorcode 431的错误,如果有不对的地方或者更好的建议还希望各位大佬指教。感谢观看大家观看。

  • 7
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
以下的资源也很不错, 加减可以看一下o 使用C++制作戰車射擊-100%提供源码 http://download.csdn.net/source/2257663 使用C++制作3D动画人物-100%提供源码 http://download.csdn.net/source/2255453 Linux kernel 每一行都完全注释-初学者必备 http://download.csdn.net/source/1982431 Programming Embedded Systems 2nd http://download.csdn.net/source/1982338 J2ME pdf and code 郭克华 http://download.csdn.net/source/2229809 C语言程序设计(Visual+C 6.0环境) http://download.csdn.net/source/2232878 Visual C++ 60 MFC + code 学习最强宝典 http://download.csdn.net/source/2236266 ASP.NET Web (第一次亲密接触ASP.NET) http://download.csdn.net/source/2241466 1 Introduction 1-1 11 Motivation 1-1 12 Objective of the Specification 1-2 13 Scope of the Document1-2 14 USB Product Compliance1-2 15 Document Organization1-3 16 Design Goals1-3 17 Related Documents1-3 2 Terms and Abbreviations 2-1 3 USB 30 Architectural Overview 3-1 31 USB 30 System Description 3-1 311 USB 30 Physical Interface3-2 3111 USB 30 Mechanical3-2 312 USB 30 Power 3-3 313 USB 30 System Configuration3-3 314 USB 30 Architecture Summary3-3 32 SuperSpeed Architecture 3-4 321 Physical Layer 3-5 322 Link Layer 3-6 323 Protocol Layer3-7 324 Robustness3-8 3241 Error Detection 3-8 3242 Error Handling 3-9 325 SuperSpeed Power Management3-9 326 Devices3-10 3261 Peripheral Devices 3-10 3262 Hubs3-11 327 Hosts 3-12 328 Data Flow Models3-12 4 SuperSpeed Data Flow Model 4-1 41 Implementer Viewpoints 4-1 42 SuperSpeed Communication Flow4-1 421 Pipes4-2 43 SuperSpeed Protocol Overview 4-2 431 Differences from USB 204-2 4311 Comparing USB 20 and SuperSpeed Transactions4-3 4312 Introduction to SuperSpeed Packets4-4 44 Generalized Transfer Description4-4 441 Data Bursting4-5 442 IN Transfers4-5 443 OUT Transfers4-6 444 Power Management and Performance4-7 Universal Serial Bus 30 Specification, Revision 10 viii 445 Control Transfers4-8 4451 Control Transfer Packet Size 4-8 4452 Control Transfer Bandwidth Requirements 4-8 4453 Control Transfer Data Sequences4-9 446 Bulk Transfers4-9 4461 Bulk Transfer Data Packet Size 4-9 446

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值