<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
Hello,</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<b>I have an nginx proxy which suddenly adding 2 cache-control headers and the last modified time is always the current time:</b></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px">curl -I https://example.com/hls/5d15498d3b4e13.57348983/1280_720_3200_5d15498d3b4e13.57348983.m3u8?token=st=1563488654~exp=1563575054~acl=/hls/5d15498d3b4e13.57348983/*~hmac=863d655766652601b77c0ba1fc94a60039c4c800d9ac7097b68edfa77b9c1cdb<br>
</span>
<div style="margin: 0px">HTTP/1.1 200 OK<br>
</div>
<div style="margin: 0px">Server: nginx/1.17.0<br>
</div>
<div style="margin: 0px">Date: Thu, 18 Jul 2019 22:28:34 GMT<br>
</div>
<div style="margin: 0px">Content-Type: application/vnd.apple.mpegurl<br>
</div>
<div style="margin: 0px">Last-Modified: Thu, 18 Jul 2019 22:28:34 GMT<br>
</div>
<div style="margin: 0px">Connection: keep-alive<br>
</div>
<div style="margin: 0px">Expires: Thu, 18 Jul 2019 23:28:34 GMT<br>
</div>
<div style="margin: 0px">Cache-Control: private, max-age=3600, max-stale=0<br>
</div>
<div style="margin: 0px">Cache-Control: public max-age=31536000 s-maxage=31536000<br>
</div>
<div style="margin: 0px">Access-Control-Allow-Origin: *<br>
</div>
<div style="margin: 0px">Access-Control-Allow-Credentials: true<br>
</div>
<div style="margin: 0px">Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Origin,X-Auth-Token,Authorization,Accept,Client-Security-Token<br>
</div>
<span style="margin: 0px">Access-Control-Allow-Methods: OPTIONS, GET</span><br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><b>and this is the config:</b></span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><span style="margin: 0px">server {<br>
</span>
<div style="margin: 0px">listen 443 ssl;<br>
</div>
<div style="margin: 0px">server_name example.com;<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> # security for bypass so localhost can empty cache<br>
</div>
<div style="margin: 0px"> if ($remote_addr ~ "^(127.0.0.1)$") {<br>
</div>
<div style="margin: 0px"> set $bypass $http_secret_header;<br>
</div>
<div style="margin: 0px"> }<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> </div>
<div style="margin: 0px"> location '/.well-known/acme-challenge' {<br>
</div>
<div style="margin: 0px"> root /usr/local/www/example.com;<br>
</div>
<div style="margin: 0px"> allow all;<br>
</div>
<div style="margin: 0px"> default_type "text/plain";<br>
</div>
<div style="margin: 0px">}<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> if ($arg_token) {</div>
<div style="margin: 0px"> set $test_token $arg_token;<br>
</div>
<div style="margin: 0px"> }<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> if ($cookie_token) {<br>
</div>
<div style="margin: 0px"> set $test_token $cookie_token;<br>
</div>
<div style="margin: 0px"> }<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> <span> </span><br>
</div>
<div style="margin: 0px"> <span> </span><br>
</div>
<div style="margin: 0px"> location / {<br>
</div>
<div style="margin: 0px"> #Proxy related config<br>
</div>
<div style="margin: 0px"> proxy_cache s3_cache;<br>
</div>
<div style="margin: 0px"> proxy_http_version 1.1;<br>
</div>
<div style="margin: 0px"> proxy_read_timeout 10s;<br>
</div>
<div style="margin: 0px"> proxy_send_timeout 10s;<br>
</div>
<div style="margin: 0px"> proxy_connect_timeout 10s;<br>
</div>
<div style="margin: 0px"> proxy_cache_methods GET HEAD;<br>
</div>
<div style="margin: 0px"> proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;<br>
</div>
<div style="margin: 0px"> proxy_cache_lock on;<br>
</div>
<div style="margin: 0px"> proxy_cache_revalidate on;<br>
</div>
<div style="margin: 0px"> proxy_intercept_errors on;<br>
</div>
<div style="margin: 0px"> proxy_cache_lock_age 10s;<br>
</div>
<div style="margin: 0px"> proxy_cache_lock_timeout 1h;<br>
</div>
<div style="margin: 0px"> proxy_cache_background_update on;<br>
</div>
<div style="margin: 0px"> proxy_cache_valid 200 301 302 30d;</div>
<div style="margin: 0px"> proxy_pass https://s3/;<br>
</div>
<div style="margin: 0px"> proxy_cache_bypass $cookie_nocache $arg_nocache;<br>
</div>
<div style="margin: 0px"> proxy_cache_key "$scheme$host$request_uri";<br>
</div>
<div style="margin: 0px"> <span> </span><br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> #Proxy Buffers<br>
</div>
<div style="margin: 0px"> proxy_buffering on;<br>
</div>
<div style="margin: 0px"> proxy_buffer_size 1k;<br>
</div>
<div style="margin: 0px"> proxy_buffers 24 4k;<br>
</div>
<div style="margin: 0px"> proxy_busy_buffers_size 8k;<br>
</div>
<div style="margin: 0px"> proxy_max_temp_file_size 2048m;<br>
</div>
<div style="margin: 0px"> proxy_temp_file_write_size 32k; <span> </span><br>
</div>
<div style="margin: 0px"> <br>
</div>
<div style="margin: 0px"> #Add Headers<br>
</div>
<div style="margin: 0px"> add_header Cache-Control 'public max-age=31536000 s-maxage=31536000';<br>
</div>
<div style="margin: 0px"> add_header X-Cache-Status $upstream_cache_status always;<br>
</div>
<div style="margin: 0px"> add_header X-Proxy-Cache $upstream_cache_status;<span> </span><br>
</div>
<div style="margin: 0px"> add_header 'Access-Control-Allow-Origin' '*';<br>
</div>
<div style="margin: 0px"> add_header 'Access-Control-Allow-Credentials' 'true';<br>
</div>
<div style="margin: 0px"> add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Origin,X-Auth-Token,Authorization,Accept,Client-Security-Token';<br>
</div>
<div style="margin: 0px"> add_header 'Access-Control-Allow-Methods' 'OPTIONS, GET';<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> #Header related config<br>
</div>
<div style="margin: 0px"> proxy_set_header Connection "";<br>
</div>
<div style="margin: 0px"> proxy_set_header Authorization '';<br>
</div>
<div style="margin: 0px"> proxy_set_header Host 'xxxxx.s3.amazonaws.com';<br>
</div>
<div style="margin: 0px"> proxy_hide_header x-amz-id-2;<br>
</div>
<div style="margin: 0px"> proxy_hide_header x-amz-request-id;<br>
</div>
<div style="margin: 0px"> proxy_hide_header x-amz-meta-server-side-encryption;<br>
</div>
<div style="margin: 0px"> proxy_hide_header x-amz-server-side-encryption;<br>
</div>
<div style="margin: 0px"> proxy_hide_header Set-Cookie;<br>
</div>
<div style="margin: 0px"> proxy_hide_header x-amz-storage-class;<br>
</div>
<div style="margin: 0px"> proxy_ignore_headers Set-Cookie;<br>
</div>
<div style="margin: 0px"> proxy_ignore_headers Cache-Control;<br>
</div>
<div style="margin: 0px"> proxy_ignore_headers X-Accel-Expires Expires; <span> </span><br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> # enable thread bool<br>
</div>
<div style="margin: 0px"> aio threads=default;<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> akamai_token_validate $test_token;<br>
</div>
<div style="margin: 0px"> akamai_token_validate_key xxxxxxxxxxxxxxx;<br>
</div>
<div style="margin: 0px"> secure_token $token;<br>
</div>
<div style="margin: 0px"> secure_token_types text/xml application/vnd.apple.mpegurl;<br>
</div>
<div style="margin: 0px"> secure_token_content_type_f4m text/xml;<br>
</div>
<div style="margin: 0px"> secure_token_expires_time 100d;<br>
</div>
<div style="margin: 0px"> secure_token_query_token_expires_time 1h;<br>
</div>
<div style="margin: 0px"> secure_token_tokenize_segments on;<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"> <span> </span><br>
</div>
<div style="margin: 0px"> }<br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px">}<br>
</div>
<span style="margin: 0px"></span><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
I don't know why is adding this control header: <span style="margin: 0px; background-color: rgb(255, 255, 255); display: inline !important">Cache-Control: private, max-age=3600, max-stale=0</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px; background-color: rgb(255, 255, 255); display: inline !important">I don't have this in the config. Also, I re-installed Nginx but still getting the same issue</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px; background-color: rgb(255, 255, 255); display: inline !important">Thanks</span></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span style="margin: 0px; background-color: rgb(255, 255, 255); display: inline !important">Andrew </span></div>
<br>
</div>
</body>
</html>