Prerequisite: You need to compile the ngx_http_headers_module module to support header information operations add_header It means to add custom header information to the response header. The instruction is add_header name value [always];. It can be used in http {}, server {}, location {}, if in location {} context. Note: You can declare multiple add_header instructions. If and only if the current block does not have add_header, the add_header information declared by the parent will be inherited. For example: server { add_header a 123; location / { root /path; } location /download/ { add_header b 321; } } In the example above, when accessing the /download/ route, a header such as b 321 will be returned, while when accessing the / route, a header such as a 123 will be returned as specified by the parent. add_trailer It means to add custom header information to the end of the response header. The instruction is add_trailer name value [always];. It can be used in the http {}, server {}, location {}, if in location {} context. It will only take effect when the response status code is equal to 200, 201, 206, 301, 302, 303, 307, or 308. If the always parameter is specified, the header information will be ignored in all responses. Note: You can declare multiple add_trailer instructions. If and only if there is no add_trailer in the current block, the add_trailer information declared by the parent will be inherited. See add_header for an example. expires Enable or disable, add or modify the "Expires" and "Cache-Control" fields in the response headers. The directives are expires [modified] time; or expires epoch | max | off; which takes effect when the response status code is 200, 201 (1.3.10), 204, 206, 301, 302, 303, 304, 307 (1.1.16, 1.0.13), or 308 (1.13.0). The time parameter can be a positive or negative time. The time in the "Expires" field is calculated as the sum of the current time and the time specified in time. If the modified parameter is used (0.7.0, 0.6.32), the time is calculated as the sum of the file modification time and the time specified in the time directive. Additionally, a time of day can be specified using the "@" prefix (0.7.9, 0.6.34): expires @15h30m; The content of the "Cache-Control" field depends on the symbol at the specified time:
The epoch parameter sets "Expires" to the value "Thu, 01 Jan 1970 00:00:01 GMT" and "Cache-Control" to "no-cache". The max parameter sets "Expires" to the value "Thu, 31 Dec 2037 23:55:55 GMT" and "Cache-Control" to 10 years. The off parameter disables adding or modifying the "Expires" and "Cache-Control" response header fields. The last argument value can contain variables (1.7.9): For example: map $sent_http_content_type $expires { default off; application/pdf 42d; ~image/ max; } expires $expires; The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of JavaScript progress management
>>: MySQL 5.7.21 decompression version installation Navicat database operation tool installation
Table of contents 1. Basics 2. Problem Descriptio...
Because I have been tinkering with Linux recently...
First, let's simulate the data coming from th...
Recently, a database in the production environmen...
Nowadays, whether you are on the sofa at home or ...
Table of contents SSH protocol SSH Connection pro...
Table of contents 1. router-view 2. router-link 3...
1. Download Maven Maven official website: http://...
This article summarizes some common MySQL optimiz...
This article shares the specific code for impleme...
Problem Description As we all know, the SQL to so...
Notes on installing MySQL database, share with ev...
During the installation of Ubuntu 18, the mmx64.e...
How to install MySQL 5.7.18 on Linux 1. Download ...
Table of contents 1. Project Integration 1. CDN i...