<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://it-arts.net/index.php?action=history&amp;feed=atom&amp;title=NGINX_-_Reverse_Proxy_With_Caching</id>
	<title>NGINX - Reverse Proxy With Caching - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://it-arts.net/index.php?action=history&amp;feed=atom&amp;title=NGINX_-_Reverse_Proxy_With_Caching"/>
	<link rel="alternate" type="text/html" href="https://it-arts.net/index.php?title=NGINX_-_Reverse_Proxy_With_Caching&amp;action=history"/>
	<updated>2026-05-02T18:47:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://it-arts.net/index.php?title=NGINX_-_Reverse_Proxy_With_Caching&amp;diff=818&amp;oldid=prev</id>
		<title>Admin: Text replacement - &quot;Category:Wiki&quot; to &quot;Category:Wiki

&#039;&#039;&#039;&#039;&#039;[https://it-arts.net/index.php/Category:Wiki Return to Wiki Index]&#039;&#039;&#039;&#039;&#039;
&quot;</title>
		<link rel="alternate" type="text/html" href="https://it-arts.net/index.php?title=NGINX_-_Reverse_Proxy_With_Caching&amp;diff=818&amp;oldid=prev"/>
		<updated>2026-01-17T06:26:08Z</updated>

		<summary type="html">&lt;p&gt;Text replacement - &amp;quot;&lt;a href=&quot;/index.php/Category:Wiki&quot; title=&quot;Category:Wiki&quot;&gt;Category:Wiki&lt;/a&gt;&amp;quot; to &amp;quot;&lt;a href=&quot;/index.php/Category:Wiki&quot; title=&quot;Category:Wiki&quot;&gt;Category:Wiki&lt;/a&gt;  &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;[https://it-arts.net/index.php/Category:Wiki Return to Wiki Index]&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:26, 17 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Wiki]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Wiki]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&#039;&#039;[https://it-arts.net/index.php/Category:Wiki Return to Wiki Index]&#039;&#039;&#039;&#039;&#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://it-arts.net/index.php?title=NGINX_-_Reverse_Proxy_With_Caching&amp;diff=274&amp;oldid=prev</id>
		<title>Admin: Text replacement - &quot;Category:Post-It&quot; to &quot;Category:Wiki&quot;</title>
		<link rel="alternate" type="text/html" href="https://it-arts.net/index.php?title=NGINX_-_Reverse_Proxy_With_Caching&amp;diff=274&amp;oldid=prev"/>
		<updated>2025-12-08T16:45:53Z</updated>

		<summary type="html">&lt;p&gt;Text replacement - &amp;quot;&lt;a href=&quot;/index.php?title=Category:Post-It&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Post-It (page does not exist)&quot;&gt;Category:Post-It&lt;/a&gt;&amp;quot; to &amp;quot;&lt;a href=&quot;/index.php/Category:Wiki&quot; title=&quot;Category:Wiki&quot;&gt;Category:Wiki&lt;/a&gt;&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:45, 8 December 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Post-It&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Wiki&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://it-arts.net/index.php?title=NGINX_-_Reverse_Proxy_With_Caching&amp;diff=27&amp;oldid=prev</id>
		<title>imported&gt;Z: /* proxy_cache_valid */</title>
		<link rel="alternate" type="text/html" href="https://it-arts.net/index.php?title=NGINX_-_Reverse_Proxy_With_Caching&amp;diff=27&amp;oldid=prev"/>
		<updated>2020-04-24T12:59:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;proxy_cache_valid&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Post-It]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
http {&lt;br /&gt;
    proxy_cache_path  /data/nginx/cache  levels=1:2    keys_zone=STATIC:10m&lt;br /&gt;
    inactive=24h  max_size=1g;&lt;br /&gt;
    server {&lt;br /&gt;
        location / {&lt;br /&gt;
            proxy_pass             http://1.2.3.4;&lt;br /&gt;
            proxy_set_header       Host $host;&lt;br /&gt;
            proxy_buffering        on;&lt;br /&gt;
            proxy_cache            STATIC;&lt;br /&gt;
            proxy_cache_valid      200  1d;&lt;br /&gt;
            proxy_cache_use_stale  error timeout invalid_header updating&lt;br /&gt;
                                   http_500 http_502 http_503 http_504;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== proxy_cache_path ==&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_cache_path path [levels=levels] [use_temp_path=on|off] keys_zone=name:size [inactive=time] [max_size=size] [manager_files=number] [manager_sleep=time] [manager_threshold=time] [loader_files=number] [loader_sleep=time] [loader_threshold=time] [purger=on|off] [purger_files=number] [purger_sleep=time] [purger_threshold=time];&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the path and other parameters of a cache. Cache data are stored in files. The file name in a cache is a result of applying the MD5 function to the cache key. The levels parameter defines hierarchy levels of a cache: from 1 to 3, each level accepts values 1 or 2. For example, in the following configuration .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== proxy_pass ==&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_pass URL;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sets the protocol and address of a proxied server and an optional URI to which a location should be mapped. As a protocol, “http” or “https” can be specified. The address can be specified as a domain name or IP address, and an optional port:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_pass http://localhost:8000/uri/;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or as a UNIX-domain socket path specified after the word “unix” and enclosed in colons:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_pass http://unix:/tmp/backend.socket:/uri/;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== proxy_set_header ==&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_set_header field value;&lt;br /&gt;
&lt;br /&gt;
Default: 	&lt;br /&gt;
proxy_set_header Host $proxy_host;&lt;br /&gt;
proxy_set_header Connection close;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Allows redefining or appending fields to the request header passed to the proxied server. The value can contain text, variables, and their combinations. These directives are inherited from the previous level if and only if there are no proxy_set_header directives defined on the current level. By default, only two fields are redefined:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_set_header Host       $proxy_host;&lt;br /&gt;
proxy_set_header Connection close;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If caching is enabled, the header fields “If-Modified-Since”, “If-Unmodified-Since”, “If-None-Match”, “If-Match”, “Range”, and “If-Range” from the original request are not passed to the proxied server.&lt;br /&gt;
&lt;br /&gt;
An unchanged “Host” request header field can be passed like this:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_set_header Host       $http_host;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if this field is not present in a client request header then nothing will be passed. In such a case it is better to use the $host variable - its value equals the server name in the “Host” request header field or the primary server name if this field is not present:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_set_header Host       $host;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the server name can be passed together with the port of the proxied server:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_set_header Host       $host:$proxy_port;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the value of a header field is an empty string then this field will not be passed to a proxied server:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_set_header Accept-Encoding &amp;quot;&amp;quot;;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== proxy_buffering ==&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_buffering on | off;&lt;br /&gt;
&lt;br /&gt;
Default: 	&lt;br /&gt;
proxy_buffering on;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== proxy_cache ==&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_cache_use_stale error | timeout | invalid_header | updating | http_500 | http_502 | http_503 | http_504 | http_403 | http_404 | http_429 | off ...;&lt;br /&gt;
&lt;br /&gt;
Default:&lt;br /&gt;
proxy_cache_use_stale off;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Determines in which cases a stale cached response can be used during communication with the proxied server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== proxy_cache_valid ==&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_cache_valid [code ...] time;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Sets caching time for different response codes. For example, the following directives&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    proxy_cache_valid 200 302 10m;&lt;br /&gt;
    proxy_cache_valid 404      1m;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
set 10 minutes of caching for responses with codes 200 and 302 and 1 minute for responses with code 404.&lt;br /&gt;
&lt;br /&gt;
If only caching time is specified&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    proxy_cache_valid 5m;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then only 200, 301, and 302 responses are cached.&lt;br /&gt;
&lt;br /&gt;
In addition, the any parameter can be specified to cache any responses:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    proxy_cache_valid 200 302 10m;&lt;br /&gt;
    proxy_cache_valid 301      1h;&lt;br /&gt;
    proxy_cache_valid any      1m;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== proxy_cache_use_stale ==&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
proxy_cache_use_stale error | timeout | invalid_header | updating | http_500 | http_502 | http_503 | http_504 | http_403 | http_404 | http_429 | off ...;&lt;br /&gt;
&lt;br /&gt;
Default: 	&lt;br /&gt;
proxy_cache_use_stale off;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Determines in which cases a stale cached response can be used during communication with the proxied server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
&lt;br /&gt;
* https://www.nginx.com/resources/wiki/start/topics/examples/reverseproxycachingexample/&lt;br /&gt;
* https://nginx.org/en/docs/http/ngx_http_proxy_module.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>imported&gt;Z</name></author>
	</entry>
</feed>