Front end learning - header related knowledge

Tom conton 2020-11-13 02:05:26
end learning header related knowledge

One . Request header


Requested server URL

Describe the destination where the request will be sent , Include , And only include domain name and port number .
In any type of request ,request Will include this header Information .

Server pass host To find out which website to visit

Virtual host (virtual hosting) I.e. shared host (shared web hosting), Virtual technology can be used to divide a complete server into several hosts , So you can run multiple sites or services on a single server .

Let's take a simple example : There is one ip The address is Server for , Google is deployed on this server 、 Baidu 、 Taobao's website . Why do we visit when , To see is Google Not Baidu or Taobao ? The reason is that Host The request header determines which virtual host to access .


2.Connection         keep-alive


Not set in browser Connection, Will default to keep-alive( A long connection )
About Connection Information about


Used to indicate where the request originated , Include , And only the agreement and domain name .
This parameter generally only exists in CORS Cross domain request in progress , You can see response There are corresponding header:Access-Control-Allow-Origin.

The article mentions about   Origin  To prevent cfrs attack

   What is mentioned here csrf attack


        1. Anti theft chain
          For example, I only allow my own website to visit my own image server
         2. Prevent malicious requests .

          Related examples :

About Origin and refere Comparison of

origin It is mainly used to explain where the initial request was initiated ;
origin Used only for Post request , and Referer For all types of requests ;
origin Method ratio of Referer Security .


Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36");

simply , Is to access the browser version and other information of the source


Because of the browser war in history , At that time, I wanted to get a web page with pictures and texts , You have to claim that you are Mozilla browser . This led to today's User-Agent Usually with Mozilla word , Out of respect for history , Everyone will fill in this part by default .

Windows NT 10.0 Is the version of the operating system I use

Win64; x64 My operating system is 64 Bit

AppleWebKit/537.36 (KHTML, like Gecko)                    Engine version

Chrome/70.0.3538.77 Safari/537.36      Browser version

Related blog

6.Accept-Encoding         gzip, deflate, br Accept-Language    zh-CN,zh;q=0.9

Accept-Encoding Requested HTTP Header announces its content encoding , It is usually a compression algorithm , The client can understand . Use content negotiation ,

Server selects one of the proposals , Use it and pass Content-Encoding The response header informs the client of its selection .

gzip Use  Lempel-Ziv code ( LZ77 ) Compression format for , with 32 position CRC .

compress Use  Lempel-Ziv-Welch( LZW ) Compression format of algorithm .

deflate Use  zlib  Compression format of structure , as well as  deflate  Compression algorithm .

br Use  Brotli  Compression format of algorithm .

identity Indicating identity function ( No compression , It doesn't change ). Even if it doesn't exist , This value is always considered acceptable .

* Match any content encoding that is not listed in the title . If the title does not exist , This is the default . This does not mean that any algorithm is supported ; It's just that there's no preference .

;q=( q Value weighting ) Any value is prioritized by a relative mass value called a weight

7.Content-Type    application/json;charset=utf-8

Content-Type( Content type ), Generally, it refers to the existence of Content-Type, Used to define the type of network files and the encoding of web pages , Decide what form the browser will take 、 What encoding reads this file , This is what we often see PHP The result of a web click is the reason to download a file or a picture .

Content-Type The header tells the client what type of content is actually returned .

Grammar format :

ext/html : HTML Format

text/plain : Plain text format

text/xml : XML Format

image/gif :gif Image format

image/jpeg :jpg Image format

image/png:png Image format

application/xhtml+xml :XHTML Format

application/xml: XML data format

application/atom+xml :Atom XML Aggregate format

application/json: JSON data format

application/pdf:pdf Format

application/msword : Word Document format

application/octet-stream : Binary stream data ( Such as common file downloads )

application/x-www-form-urlencoded : <form encType=””> In the default encType,form Form data is encoded as key/value Format send to server ( Default format of data submitted by form

Another common media format is used when uploading files :

multipart/form-data : When you need to upload files in the form , You need to use this format

8.Accept      application/json, text/plain, */*

Specify the type of content the client can receive

9.Cache-Control   no-cache

Related cache policies

本文为[Tom conton]所创,转载请带上原文链接,感谢

  1. [front end -- JavaScript] knowledge point (IV) -- memory leakage in the project (I)
  2. This mechanism in JS
  3. Vue 3.0 source code learning 1 --- rendering process of components
  4. Learning the realization of canvas and simple drawing
  5. gin里获取http请求过来的参数
  6. vue3的新特性
  7. Get the parameters from HTTP request in gin
  8. New features of vue3
  9. vue-cli 引入腾讯地图(最新 api,rocketmq原理面试
  10. Vue 学习笔记(3,免费Java高级工程师学习资源
  11. Vue 学习笔记(2,Java编程视频教程
  12. Vue cli introduces Tencent maps (the latest API, rocketmq)
  13. Vue learning notes (3, free Java senior engineer learning resources)
  14. Vue learning notes (2, Java programming video tutorial)
  15. 【Vue】—props属性
  16. 【Vue】—创建组件
  17. [Vue] - props attribute
  18. [Vue] - create component
  19. 浅谈vue响应式原理及发布订阅模式和观察者模式
  20. On Vue responsive principle, publish subscribe mode and observer mode
  21. 浅谈vue响应式原理及发布订阅模式和观察者模式
  22. On Vue responsive principle, publish subscribe mode and observer mode
  23. Xiaobai can understand it. It only takes 4 steps to solve the problem of Vue keep alive cache component
  24. Publish, subscribe and observer of design patterns
  25. Summary of common content added in ES6 + (II)
  26. No.8 Vue element admin learning (III) vuex learning and login method analysis
  27. Write a mini webpack project construction tool
  28. Shopping cart (front-end static page preparation)
  29. Introduction to the fluent platform
  30. Webpack5 cache
  31. The difference between drop-down box select option and datalist
  32. CSS review (III)
  33. Node.js学习笔记【七】
  34. Node.js learning notes [VII]
  35. Vue Router根据后台数据加载不同的组件(思考-&gt;实现-&gt;不止于实现)
  36. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  37. 【JQuery框架,Java编程教程视频下载
  38. [jQuery framework, Java programming tutorial video download
  39. Vue Router根据后台数据加载不同的组件(思考-&gt;实现-&gt;不止于实现)
  40. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  41. 【Vue,阿里P8大佬亲自教你
  42. 【Vue基础知识总结 5,字节跳动算法工程师面试经验
  43. [Vue, Ali P8 teaches you personally
  44. [Vue basic knowledge summary 5. Interview experience of byte beating Algorithm Engineer
  45. 【问题记录】- 谷歌浏览器 Html生成PDF
  46. [problem record] - PDF generated by Google browser HTML
  47. 【问题记录】- 谷歌浏览器 Html生成PDF
  48. [problem record] - PDF generated by Google browser HTML
  49. 【JavaScript】查漏补缺 —数组中reduce()方法
  50. [JavaScript] leak checking and defect filling - reduce() method in array
  51. 【重识 HTML (3),350道Java面试真题分享
  52. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  53. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  54. [re recognize HTML (3) and share 350 real Java interview questions
  55. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  56. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  57. 【重识 HTML ,nginx面试题阿里
  58. 【重识 HTML (4),ELK原来这么简单
  59. [re recognize HTML, nginx interview questions]
  60. [re recognize HTML (4). Elk is so simple