Mercurial > hg > nginx-tests
annotate proxy_cache_control.t @ 1920:79ca9ab75310
Tests: fixed h2_http2.t when nginx compiled without ALPN support.
ALPN support is only available with OpenSSL 1.0.2 or newer.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 12 Jul 2023 02:40:15 +0300 |
parents | 5a625ce0de34 |
children | a095b971fbcc |
rev | line source |
---|---|
1774
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for proxy headers Expires / Cache-Control / X-Accel-Expires. |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http proxy cache rewrite/)->plan(19); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 $t->write_file_expand('nginx.conf', <<'EOF'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 daemon off; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 events { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 http { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 proxy_cache_path %%TESTDIR%%/cache keys_zone=NAME:1m; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 server { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 listen 127.0.0.1:8080; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 server_name localhost; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 add_header X-Cache-Status $upstream_cache_status; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 location / { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 proxy_pass http://127.0.0.1:8081; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 proxy_cache NAME; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 proxy_cache_background_update on; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 location /ignore { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 proxy_pass http://127.0.0.1:8081; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 proxy_cache NAME; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 proxy_ignore_headers Cache-Control Expires; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 proxy_ignore_headers X-Accel-Expires; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 server { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 listen 127.0.0.1:8081; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 server_name localhost; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 location /expires { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 location /cache-control { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 add_header Cache-Control max-age=60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 location /x-accel-expires { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 add_header X-Accel-Expires 60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 location /x-accel-expires-at { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 add_header X-Accel-Expires @60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 location /x-accel-expires-duplicate { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 add_header X-Accel-Expires 60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 add_header X-Accel-Expires 0; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 location /ignore { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 add_header Cache-Control max-age=60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 add_header X-Accel-Expires 60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 location /cache-control-before-expires { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 add_header Cache-Control max-age=60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 add_header Expires "Thu, 01 Jan 1970 00:00:01 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 location /cache-control-after-expires { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 add_header Expires "Thu, 01 Jan 1970 00:00:01 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 add_header Cache-Control max-age=60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 location /cache-control-no-cache-before-expires { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 add_header Cache-Control no-cache; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 location /cache-control-no-cache-after-expires { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 add_header Cache-Control no-cache; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 location /x-accel-expires-before { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 add_header X-Accel-Expires 60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 add_header Expires "Thu, 01 Jan 1970 00:00:01 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 add_header Cache-Control no-cache; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 location /x-accel-expires-after { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 add_header Expires "Thu, 01 Jan 1970 00:00:01 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 add_header Cache-Control no-cache; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 add_header X-Accel-Expires 60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 location /x-accel-expires-0-before { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 add_header X-Accel-Expires 0; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 add_header Cache-Control max-age=60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 location /x-accel-expires-0-after { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 add_header Cache-Control max-age=60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 add_header X-Accel-Expires 0; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
149 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
151 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
152 location /cache-control-no-cache-one { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
153 add_header Cache-Control "no-cache, max-age=60"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
154 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
155 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
156 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
157 location /cache-control-no-cache-multi { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
158 add_header Cache-Control no-cache; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
159 add_header Cache-Control max-age=60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
160 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
161 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
162 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
163 location /extension-before-x-accel-expires { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
164 add_header Cache-Control stale-while-revalidate=2145902155; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
165 add_header X-Accel-Expires @1; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
166 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
167 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
168 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
169 location /extension-after-x-accel-expires { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
170 add_header X-Accel-Expires @1; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
171 add_header Cache-Control stale-while-revalidate=2145902155; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
172 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
173 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
174 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
175 location /set-cookie { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
176 add_header Set-Cookie foo; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
177 add_header Expires "Thu, 01 Jan 1970 00:00:01 GMT"; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
178 add_header Cache-control max-age=60; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
179 return 204; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
180 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
181 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
182 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
183 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
184 EOF |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
185 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
186 $t->run(); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
187 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
188 ############################################################################### |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
189 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
190 # cache headers work |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
191 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
192 like(get('/expires'), qr/HIT/, 'expires'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
193 like(get('/cache-control'), qr/HIT/, 'cache-control'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
194 like(get('/x-accel-expires'), qr/HIT/, 'x-accel-expires'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
195 like(get('/x-accel-expires-at'), qr/EXPIRED/, 'x-accel-expires at'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
196 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
197 TODO: { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
198 local $TODO = 'not yet' unless $t->has_version('1.23.0'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
199 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
200 # the second header to disable cache is duplicate and ignored |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
201 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
202 like(get('/x-accel-expires-duplicate'), qr/HIT/, 'x-accel-expires duplicate'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
203 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
204 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
205 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
206 # with cache headers ignored, the response will be fresh |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
207 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
208 like(get('/ignore'), qr/MISS/, 'cache headers ignored'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
209 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
210 # Cache-Control is preferred over Expires |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
211 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
212 like(get('/cache-control-before-expires'), qr/HIT/, |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
213 'cache-control before expires'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
214 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
215 TODO: { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
216 local $TODO = 'not yet' unless $t->has_version('1.23.0'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
217 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
218 like(get('/cache-control-after-expires'), qr/HIT/, |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
219 'cache-control after expires'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
220 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
221 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
222 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
223 like(get('/cache-control-no-cache-before-expires'), qr/MISS/, |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
224 'cache-control no-cache before expires'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
225 like(get('/cache-control-no-cache-after-expires'), qr/MISS/, |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
226 'cache-control no-cache after expires'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
227 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
228 # X-Accel-Expires is preferred over both Cache-Control and Expires |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
229 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
230 like(get('/x-accel-expires-before'), qr/HIT/, 'x-accel-expires before'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
231 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
232 TODO: { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
233 local $TODO = 'not yet' unless $t->has_version('1.23.0'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
234 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
235 like(get('/x-accel-expires-after'), qr/HIT/, 'x-accel-expires after'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
236 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
237 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
238 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
239 like(get('/x-accel-expires-0-before'), qr/MISS/, 'x-accel-expires 0 before'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
240 like(get('/x-accel-expires-0-after'), qr/MISS/, 'x-accel-expires 0 after'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
241 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
242 # "Cache-Control: no-cache" disables caching, no matter of "max-age" |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
243 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
244 like(get('/cache-control-no-cache-one'), qr/MISS/, |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
245 'cache-control no-cache'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
246 like(get('/cache-control-no-cache-multi'), qr/MISS/, |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
247 'cache-control no-cache multi line'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
248 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
249 # Cache-Control extensions are preserved with X-Accel-Expires |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
250 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
251 like(get('/extension-before-x-accel-expires'), |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
252 qr/STALE/, 'cache-control extensions before x-accel-expires'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
253 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
254 TODO: { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
255 local $TODO = 'not yet' unless $t->has_version('1.23.0'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
256 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
257 like(get('/extension-after-x-accel-expires'), |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
258 qr/STALE/, 'cache-control extensions after x-accel-expires'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
259 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
260 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
261 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
262 # Set-Cookie is considered when caching with Cache-Control |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
263 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
264 like(get('/set-cookie'), qr/MISS/, 'set-cookie not cached'); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
265 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
266 ############################################################################### |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
267 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
268 sub get { |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
269 my ($uri) = @_; |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
270 http_get($uri); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
271 http_get($uri); |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
272 } |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
273 |
5a625ce0de34
Tests: added proxy cache tests with upstream cache headers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
274 ############################################################################### |