余晖落尽暮晚霞,黄昏迟暮远山寻
本站
当前位置:网站首页 > 编程知识 > 正文

域名可以多长?URL长度URI长度?

xiyangw 2023-10-03 16:23 15 浏览 0 评论

今天配置下分析下nginx关于URI的部分,另外需要看下DNS的长度.简单而已,DNS长度不超过255个octets.我们是用.来分割域名的,那么每个点之间的长度不超过63个octets.

Nginx本身对于传参的长度大小支持决定于large_client_header_buffers

下面是详细分析过程.

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 字节
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 指令配置的较大缓冲区

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

```
首先不同编码,所占字节数不同。
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);

  },
```

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);
  }



相关推荐

华为交换机配置命令总结

1、配置文件相关命令[Quidway]displaycurrent-configuration显示当前生效的配置[Quidway]displaysaved-configuration显示fla...

解决账户无法登录的故障
解决账户无法登录的故障

在优化系统时错误地根据网上的提示,将唯一的Administrator账户设置为禁用,导致重启后无法进入系统。类似的故障还有使用组策略限制本地账户登录,导致重启后...

2023-10-11 17:16 xiyangw

S5720交换机登录提示初始密码存在安全风险
S5720交换机登录提示初始密码存在安全风险

问题描述客户每次登录输密码时,提示初始密码不安全,现在客户嫌麻烦想要去掉:Username:huaweiPassword:Warning:Theinitia...

2023-10-11 17:15 xiyangw

Springboot,Mybatis修改登录用户的密码
Springboot,Mybatis修改登录用户的密码

一、Mybatis.xml<updateid="changePassword"parameterType="string...

2023-10-11 17:15 xiyangw

PHP理论知识之沐浴更衣重看PHP基础(二)
PHP理论知识之沐浴更衣重看PHP基础(二)

接上篇,咱们继续讲解PHP基础八、标准PHP组件和框架的数量很多,随之产生的问题就是:单独开发的框架没有考虑到与其他框架的通信。这样对开发者和框架本身都是不利的...

2023-10-11 17:15 xiyangw

新鲜出炉UCloud云主机“数据方舟”评测报告(5)— — 关其城
新鲜出炉UCloud云主机“数据方舟”评测报告(5)— — 关其城

2015年10月29日,UCloud云主机黑科技——“数据方舟”功能正式上线,首轮内测随即开放。截止至2015年12月6日,我们共收到了534位用户的评测申...

2023-10-11 17:14 xiyangw

业余无线电Q简语及英文缩语
业余无线电Q简语及英文缩语

Q简语:语音通信及CW通信通用(加粗为常用)QRA电台何台QRB电台间之距离QRG告之正确频率QRH频率是否变动QRI发送音调QRJ能否收到QRK信号之可...

2023-10-11 17:14 xiyangw

非常详细!如何理解表格存储的多版本、生命周期和有效版本偏差
非常详细!如何理解表格存储的多版本、生命周期和有效版本偏差

表格存储在8月份推出了容量型实例,直接支持了表级别最大版本号和生命周期,高性能实例也将会在9月中旬支持这两个特性。那么,最大版本号和生命周期以及特有的...

2023-10-11 17:14 xiyangw

H3C交换机恢复出厂和各种基本配置,这20个要点你知道吗?
H3C交换机恢复出厂和各种基本配置,这20个要点你知道吗?

私信“干货”二字,即可领取138G伺服与机器人专属及电控资料!H3C交换机不知道密码如何恢复出厂设置1、开机启动,Ctrl+B进入bootrom菜单,选择恢复出...

2023-10-11 17:13 xiyangw

在使用移动支付系统的时候如何保护信息安全?

移动支付的方式近年来不断被更新,使得Venmo(据嘉丰瑞德理财师了解,此为美国的“支付宝”)之类的支付方式已经可以某种意义上代替随身携带现金了。但是你必须防范那些第三方应用程序轻松地获取你的银行卡以及...

界面控件DevExpress WinForms MVVM入门指南——登录表单(下)

从本文档中,您将了解如何向应用程序添加登录表单。在本节教程中着重讨论了如何实现此任务,这基本上是附加应用程序功能的一部分。DevExpressUniversalSubscription官方最新版免...

linux基础命令(一)
linux基础命令(一)

为啥要学linux?您可能熟悉WindowsXP、Windows7、Windows10和MacOSX等操作系统。Linux就是这样一种强大的操...

2023-10-11 17:13 xiyangw

MySQL数据库密码忘记了,怎么办?

#头条创作挑战赛#MySQL数据库密码忘记了且没有其他可以修改账号密码的账户时怎么办呢?登录MySQL,密码输入错误/*密码错误,报如下错误*/[root@TESTDB~]#mysql-u...

MobaXterm忘记Session密码,如何查看已保存的密码
MobaXterm忘记Session密码,如何查看已保存的密码

MobaXterm工具登录过SSH终端后,如果存储了Session(存储后再连接ssh的时候只需要输入账号不需要输入密码就可以直接连接上ssh),则可以...

2023-10-11 17:12 xiyangw

华为交换机密码丢失修改方法
华为交换机密码丢失修改方法

华为S2300交换机找回密码设置一、目的交换机的console和telnet密码丢失,无法登录设备。交换机已进行过数据配置,要把密码恢复而数据配置不能丢失。二、...

2023-10-11 17:12 xiyangw

取消回复欢迎 发表评论: