今天配置下分析下Nginx關(guān)于URI的部分,另外需要看下DNS的長度.簡單而已,DNS長度不超過255個octets.我們是用.來分割域名的,那么每個點之間的長度不超過63個octets.
Nginx本身對于傳參的長度大小支持決定于
large_client_header_buffers
下面是詳細(xì)分析過程.
nginx location
- 塊通過指定模式來與客戶端請求的URI相匹配 Sets configuration depending on a request URI.
- What's different between URI, request-URI and URL? https://stackoverflow.com/questions/34849543/whats-different-between-uri-request-uri-and-url
- What's different between URI, request-URI and URL?
- URI vs. URL
- http://nginx.org/en/docs/http/ngxhttpcore_module.html#location
nginx largeclientheader_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;
- 1kb=1024 位1kB=1024 字節(jié)
Nginx
如果您的 nginx 錯誤日志包含 client sent too long URI while reading client request line,則表示請求 URI 已超出允許的限制。
在 nginx 中,允許的最大 URI 長度由 large_client_header_buffers 指令定義,它由兩個值組成:緩沖區(qū)的數(shù)量和大小。 它默認(rèn)為 4 8k,這意味著 Nginx 將每個請求行限制為 8 KB。
large_client_header_buffers 4 128K;
設(shè)置用于讀取大型客戶端請求標(biāo)頭的緩沖區(qū)的最大數(shù)量和大小。 一個請求行不能超過一個緩沖區(qū)的大小,否則會向客戶端返回 414(Request-URI Too Large)錯誤。 請求頭字段也不能超過一個緩沖區(qū)的大小,否則返回 400(Bad Request)錯誤給客戶端。 緩沖區(qū)僅按需分配。 默認(rèn)情況下,緩沖區(qū)大小等于 8K 字節(jié)。 如果在請求處理結(jié)束后連接轉(zhuǎn)換為保持活動狀態(tài),則釋放這些緩沖區(qū)。
設(shè)置讀取客戶端請求頭的緩沖區(qū)大小。對于大多數(shù)請求,1K 字節(jié)的緩沖區(qū)就足夠了。但是,如果請求中包含長 cookie,或者來自 WAP 客戶端,則可能 1K 是不適用的。如果請求行或請求頭域不適合此緩沖區(qū),則會分配由 large_client_header_buffers 指令配置的較大緩沖區(qū)
linux configure
- keyword for search [nginx upstream proxy length ]
- https://www.cyberciti.biz/faq/nginx-upstream-sent-too-big-header-while-reading-response-header-from-upstream/
- Use the getconf command to find os level page size value in bytes:
- getconf PAGESIZE 4096
common nginx.conf
```
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.
```
dns length
- https://en.wikipedia.org/wiki/Hostname
- Hostnames are composed of a sequence of labels concatenated with dots. For example, "en.wikipedia.org" is a hostname. Each label must be from 1 to 63 characters long.[2] The entire hostname, including the delimiting dots, has a maximum of 253 ASCII characters.[3]
- https://www.ietf.org/rfc/rfc1035.txt
- 2.3.4. Size limits Various objects and parameters in the DNS have size limits. They are listed below. Some could be easily changed, others are more fundamental. labels 63 octets or less names 255 octets or less TTL positive values of a signed 32 bit number. UDP messages 512 octets or less 1. DOMAIN NAME SPACE AND RR DEFINITIONS 3.1. Name space definitions Domain names in messages are expressed in terms of a sequence of labels. Each label is represented as a one octet length field followed by that number of octets. Since every domain name ends with the null label of the root, a domain name is terminated by a length byte of zero. The high order two bits of every length octet must be zero, and the remaining six bits of the length field limit the label to 63 octets or less. To simplify implementations, the total length of a domain name (i.e., label octets and label length octets) is restricted to 255 octets or less. Although labels can contain any 8 bit values in octets that make up a label, it is strongly recommended that labels follow the preferred syntax described elsewhere in this memo, which is compatible with existing host naming conventions. Name servers and resolvers must compare labels in a case-insensitive manner (i.e., A=a), assuming ASCII with zero parity. Non-alphabetic codes must match exactly.
- https://devblogs.microsoft.com/oldnewthing/20120412-00/?p=7873
about KB
```
首先不同編碼,所占字節(jié)數(shù)不同。
1,ASCII碼:一個英文字母(不分大小寫)占一個字節(jié)的空間,一個中文漢字占兩個字度節(jié)的空間。
2,UTF-8編碼:一個英文字符等于一個字節(jié),一個中文(含繁體)等于三個字節(jié)。中文標(biāo)點占三個字節(jié),英文標(biāo)點占一個字節(jié)
3,Unicode編碼:一個英文等于兩個字節(jié),一個中文(含繁體)等于兩個字節(jié)。中文標(biāo)點占兩個字節(jié),英文標(biāo)點占兩個字節(jié)
字節(jié)是指Byte
字符是一種數(shù)據(jù)類型,通常是char,更具不同語言,占據(jù)不同字節(jié)大小。
- 1kb=1024 位1kB=1024 字節(jié)
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);
},
```
spring context path limitation
- spring context path limitation
@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);
}