今天配置下分析下Nginx关于URI的部分,另外需要看下DNS的长度.简单而已,DNS长度不超过255个octets.我们是用.来分割域名的,那么每个点之间的长度不超过63个octets.
Nginx本身对于传参的长度大小支持决定于
large_client_header_buffers
下面是详细分析过程.
reference:
https://www.digitalocean.com/community/tutorials/understanding-nginx-http-proxying-load-balancing-buffering-and-caching
http://nginx.org/en/docs/http/ngxhttpcoremodule.html#largeclientheaderbuffers
http://nginx.org/en/docs/http/ngxhttpproxymodule.html#proxybuffers
Our nginx.conf configure // largeclientheader_buffers 4 32k;
dump conf from running nginx process ==> As of Nginx 1.9.2 you can dump the Nginx config with the -T flag: ==> /sbin/nginx -T
-t — test the configuration file: nginx checks the configuration for correct syntax, and then tries to open files referred in the configuration.
-T — same as -t, but additionally dump configuration files to standard output (1.9.2). http { include mime.types; default_type Application/octet-stream; #increase proxy buffer size proxy_buffer_size 32k; proxy_buffers 4 128k; proxy_busy_buffers_size 256k; #increase the header size to 32K large_client_header_buffers 4 32k;
Nginx
如果您的 nginx 错误日志包含 client sent too long URI while reading client request line,则表示请求 URI 已超出允许的限制。
在 nginx 中,允许的最大 URI 长度由 large_client_header_buffers 指令定义,它由两个值组成:缓冲区的数量和大小。 它默认为 4 8k,这意味着 Nginx 将每个请求行限制为 8 KB。
large_client_header_buffers 4 128K;
设置用于读取大型客户端请求标头的缓冲区的最大数量和大小。 一个请求行不能超过一个缓冲区的大小,否则会向客户端返回 414(Request-URI Too Large)错误。 请求头字段也不能超过一个缓冲区的大小,否则返回 400(Bad Request)错误给客户端。 缓冲区仅按需分配。 默认情况下,缓冲区大小等于 8K 字节。 如果在请求处理结束后连接转换为保持活动状态,则释放这些缓冲区。
设置读取客户端请求头的缓冲区大小。对于大多数请求,1K 字节的缓冲区就足够了。但是,如果请求中包含长 cookie,或者来自 WAP 客户端,则可能 1K 是不适用的。如果请求行或请求头域不适合此缓冲区,则会分配由 large_client_header_buffers 指令配置的较大缓冲区
```
gsutil cat gs://nginx/a.conf
service=name
enables resolving of DNS SRV records and sets the service name (1.9.13). In order for this parameter to work, it is necessary to specify the resolve parameter for the server and specify a hostname without a port number.
If the service name does not contAIn a dot (“.”), then the RFC-compliant name is constructed and the TCP protocol is added to the service prefix. For example, to look up the _http._tcp.backend.example.com SRV record, it is necessary to specify the directive:
server backend.example.com service=http resolve;
If the service name contains one or more dots, then the name is constructed by joining the service prefix and the server name. For example, to look up the _http._tcp.backend.example.com and server1.backend.example.com SRV records, it is necessary to specify the directives:
server backend.example.com service=_http._tcp resolve;
server example.com service=server1.backend resolve;
Highest-priority SRV records (records with the same lowest-number priority value) are resolved as primary servers, the rest of SRV records are resolved as backup servers. If the backup parameter is specified for the server, high-priority SRV records are resolved as backup servers, the rest of SRV records are ignored.
```
```
首先不同编码,所占字节数不同。
1,ASCII码:一个英文字母(不分大小写)占一个字节的空间,一个中文汉字占两个字度节的空间。
2,UTF-8编码:一个英文字符等于一个字节,一个中文(含繁体)等于三个字节。中文标点占三个字节,英文标点占一个字节
3,Unicode编码:一个英文等于两个字节,一个中文(含繁体)等于两个字节。中文标点占两个字节,英文标点占两个字节
字节是指Byte
字符是一种数据类型,通常是char,更具不同语言,占据不同字节大小。
- 1kb=1024 位1kB=1024 字节
using wc :
-c, --bytes print the byte counts
-m, --chars print the character counts
]$ echo "local-stackdriver-agent.stackdriver.com"|wc -c
40
$ echo "local-stackdriver-agent.stackdriver.com"|wc -m
40
https://blog.csdn.NET/weixin_48702807/article/details/120199304
getStringSize(text) {
let textlength = Buffer.byteLength(text, 'utf8'); //得到占多少 bytes
let size = textlength / 1024; //得到字符串占多少 KB
return size.toFixed(2);
},
```
@RequestMapping(value = {REST_PREFIX + "/{key}"}, method = {RequestMethod.GET})
public DashboardItem getExceptionByKey(@PathVariable("key") String key, HttpServletRequest request, HttpServletResponse httpResponse_p) {
log.info("URL is {}", request.getRequestURL());
log.info("Key is {}", key);
return InspectionUtils.getExceptionByKey(key);
}