Samesite - proxy that can cache partial transfers

Hex Artifact Content
anonymous

Hex Artifact Content

Artifact 30df87d6c823b56dd954570a5ede034ec6aeab38be4d18cb0893d9abc19abc82:


0000: 23 20 73 61 6d 70 6c 65 20 6e 67 69 6e 78 20 63  # sample nginx c
0010: 6f 6e 66 69 67 20 74 6f 20 73 65 72 76 65 20 74  onfig to serve t
0020: 68 65 20 6c 6f 63 61 6c 20 73 69 74 65 0a 0a 73  he local site..s
0030: 65 72 76 65 72 20 7b 0a 09 6c 69 73 74 65 6e 20  erver {..listen 
0040: 2a 3a 38 30 3b 0a 09 6c 69 73 74 65 6e 20 5b 66  *:80;..listen [f
0050: 65 63 30 3a 3a 31 5d 3a 38 30 3b 0a 09 73 65 72  ec0::1]:80;..ser
0060: 76 65 72 5f 6e 61 6d 65 20 73 69 74 65 2e 74 6f  ver_name site.to
0070: 2e 68 69 6a 61 63 6b 3b 0a 09 61 63 63 65 73 73  .hijack;..access
0080: 5f 6c 6f 67 20 2f 76 61 72 2f 6c 6f 67 2f 6e 67  _log /var/log/ng
0090: 69 6e 78 2f 73 69 74 65 5f 6e 61 6d 65 2e 61 63  inx/site_name.ac
00a0: 63 65 73 73 2e 6c 6f 67 3b 0a 09 65 72 72 6f 72  cess.log;..error
00b0: 5f 6c 6f 67 20 2f 76 61 72 2f 6c 6f 67 2f 6e 67  _log /var/log/ng
00c0: 69 6e 78 2f 73 69 74 65 5f 6e 61 6d 65 2e 65 72  inx/site_name.er
00d0: 72 6f 72 2e 6c 6f 67 20 64 65 62 75 67 3b 0a 09  ror.log debug;..
00e0: 23 20 69 66 20 6e 6f 20 66 69 6c 65 20 66 6f 75  # if no file fou
00f0: 6e 64 20 6c 6f 63 61 6c 6c 79 20 77 65 20 61 72  nd locally we ar
0100: 65 20 62 72 65 61 6b 69 6e 67 20 63 6f 6e 6e 65  e breaking conne
0110: 63 74 69 6f 6e 0a 09 23 20 68 65 6c 70 73 20 77  ction..# helps w
0120: 69 74 68 20 63 6c 69 65 6e 74 73 20 74 68 61 74  ith clients that
0130: 20 74 72 65 61 74 20 34 30 34 20 61 73 20 67 65   treat 404 as ge
0140: 6e 65 72 61 6c 20 65 72 72 6f 72 0a 09 65 78 70  neral error..exp
0150: 69 72 65 73 20 2d 31 3b 0a 09 74 72 79 5f 66 69  ires -1;..try_fi
0160: 6c 65 73 20 24 75 72 69 20 40 62 72 65 61 6b 3b  les $uri @break;
0170: 0a 09 65 72 72 6f 72 5f 70 61 67 65 20 34 30 34  ..error_page 404
0180: 20 3d 20 40 62 72 65 61 6b 3b 0a 09 6c 6f 67 5f   = @break;..log_
0190: 6e 6f 74 5f 66 6f 75 6e 64 20 6f 66 66 3b 0a 09  not_found off;..
01a0: 23 20 61 75 74 6f 69 6e 64 65 78 20 6f 6e 3b 0a  # autoindex on;.
01b0: 0a 09 6c 6f 63 61 74 69 6f 6e 20 2f 20 7b 0a 09  ..location / {..
01c0: 09 69 66 20 28 24 72 65 71 75 65 73 74 5f 6d 65  .if ($request_me
01d0: 74 68 6f 64 20 21 3d 20 48 45 41 44 29 20 7b 0a  thod != HEAD) {.
01e0: 09 09 09 72 6f 6f 74 20 2f 68 6f 6d 65 2f 61 72  ...root /home/ar
01f0: 63 61 64 65 2f 77 77 77 2f 77 69 6e 64 6f 77 73  cade/www/windows
0200: 75 70 64 61 74 65 3b 0a 09 09 7d 0a 09 7d 0a 0a  update;...}..}..
0210: 09 6c 6f 63 61 74 69 6f 6e 20 40 62 72 65 61 6b  .location @break
0220: 20 7b 0a 09 09 70 72 6f 78 79 5f 70 61 73 73 20   {...proxy_pass 
0230: 68 74 74 70 3a 2f 2f 6c 6f 63 61 6c 68 6f 73 74  http://localhost
0240: 3a 38 30 30 38 3b 0a 09 09 70 72 6f 78 79 5f 73  :8008;...proxy_s
0250: 65 74 5f 68 65 61 64 65 72 20 48 6f 73 74 20 64  et_header Host d
0260: 6f 77 6e 6c 6f 61 64 2e 77 69 6e 64 6f 77 73 75  ownload.windowsu
0270: 70 64 61 74 65 2e 63 6f 6d 3b 0a 09 09 70 72 6f  pdate.com;...pro
0280: 78 79 5f 72 65 61 64 5f 74 69 6d 65 6f 75 74 20  xy_read_timeout 
0290: 36 30 30 3b 0a 09 7d 0a 7d 0a                    600;..}.}.