<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);">
Hello,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<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="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>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>HTTP/1.1 200 OK<br>
</div>
<div>Server: nginx/1.17.0<br>
</div>
<div>Date: Thu, 18 Jul 2019 22:28:34 GMT<br>
</div>
<div>Content-Type: application/vnd.apple.mpegurl<br>
</div>
<div>Last-Modified: Thu, 18 Jul 2019 22:28:34 GMT<br>
</div>
<div>Connection: keep-alive<br>
</div>
<div>Expires: Thu, 18 Jul 2019 23:28:34 GMT<br>
</div>
<div>Cache-Control: private, max-age=3600, max-stale=0<br>
</div>
<div>Cache-Control: public max-age=31536000 s-maxage=31536000<br>
</div>
<div>Access-Control-Allow-Origin: *<br>
</div>
<div>Access-Control-Allow-Credentials: true<br>
</div>
<div>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>Access-Control-Allow-Methods: OPTIONS, GET</span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><b>and this is the config:</b></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><span>server {<br>
</span>
<div>listen 443 ssl;<br>
</div>
<div>server_name example.com;<br>
</div>
<div><br>
</div>
<div>        # security for bypass so localhost can empty cache<br>
</div>
<div>        if ($remote_addr ~ "^(127.0.0.1)$") {<br>
</div>
<div>            set $bypass $http_secret_header;<br>
</div>
<div>        }<br>
</div>
<div><br>
</div>
<div>        </div>
<div>        location  '/.well-known/acme-challenge' {<br>
</div>
<div>                   root /usr/local/www/example.com;<br>
</div>
<div>                   allow all;<br>
</div>
<div>           default_type "text/plain";<br>
</div>
<div>}<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>        if ($arg_token) {</div>
<div>                        set $test_token $arg_token;<br>
</div>
<div>        }<br>
</div>
<div><br>
</div>
<div>        if ($cookie_token) {<br>
</div>
<div>                        set $test_token $cookie_token;<br>
</div>
<div>        }<br>
</div>
<div><br>
</div>
<div>      <br>
</div>
<div>      <br>
</div>
<div>        location / {<br>
</div>
<div>           #Proxy related config<br>
</div>
<div>           proxy_cache s3_cache;<br>
</div>
<div>           proxy_http_version     1.1;<br>
</div>
<div>           proxy_read_timeout 10s;<br>
</div>
<div>           proxy_send_timeout 10s;<br>
</div>
<div>           proxy_connect_timeout 10s;<br>
</div>
<div>           proxy_cache_methods GET HEAD;<br>
</div>
<div>           proxy_cache_use_stale  error timeout updating http_500 http_502 http_503 http_504;<br>
</div>
<div>           proxy_cache_lock       on;<br>
</div>
<div>           proxy_cache_revalidate on;<br>
</div>
<div>           proxy_intercept_errors on;<br>
</div>
<div>           proxy_cache_lock_age 10s;<br>
</div>
<div>           proxy_cache_lock_timeout 1h;<br>
</div>
<div>           proxy_cache_background_update on;<br>
</div>
<div>           proxy_cache_valid      200 301 302  30d;</div>
<div>           proxy_pass             https://s3/;<br>
</div>
<div>           proxy_cache_bypass     $cookie_nocache $arg_nocache;<br>
</div>
<div>           proxy_cache_key "$scheme$host$request_uri";<br>
</div>
<div>      <br>
</div>
<div><br>
</div>
<div>   #Proxy Buffers<br>
</div>
<div>   proxy_buffering on;<br>
</div>
<div>           proxy_buffer_size 1k;<br>
</div>
<div>           proxy_buffers 24 4k;<br>
</div>
<div>           proxy_busy_buffers_size 8k;<br>
</div>
<div>           proxy_max_temp_file_size 2048m;<br>
</div>
<div>           proxy_temp_file_write_size 32k;   <br>
</div>
<div>           <br>
</div>
<div>           #Add Headers<br>
</div>
<div>           add_header             Cache-Control 'public max-age=31536000 s-maxage=31536000';<br>
</div>
<div>           add_header             X-Cache-Status $upstream_cache_status always;<br>
</div>
<div>           add_header             X-Proxy-Cache $upstream_cache_status; <br>
</div>
<div>           add_header             'Access-Control-Allow-Origin' '*';<br>
</div>
<div>           add_header             'Access-Control-Allow-Credentials' 'true';<br>
</div>
<div>           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>           add_header             'Access-Control-Allow-Methods' 'OPTIONS, GET';<br>
</div>
<div><br>
</div>
<div>           #Header related config<br>
</div>
<div>           proxy_set_header       Connection "";<br>
</div>
<div>           proxy_set_header       Authorization '';<br>
</div>
<div>           proxy_set_header       Host 'xxxxx.s3.amazonaws.com';<br>
</div>
<div>           proxy_hide_header      x-amz-id-2;<br>
</div>
<div>           proxy_hide_header      x-amz-request-id;<br>
</div>
<div>           proxy_hide_header      x-amz-meta-server-side-encryption;<br>
</div>
<div>           proxy_hide_header      x-amz-server-side-encryption;<br>
</div>
<div>           proxy_hide_header      Set-Cookie;<br>
</div>
<div>           proxy_hide_header      x-amz-storage-class;<br>
</div>
<div>           proxy_ignore_headers   Set-Cookie;<br>
</div>
<div>   proxy_ignore_headers   Cache-Control;<br>
</div>
<div>   proxy_ignore_headers   X-Accel-Expires Expires;   <br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>   # enable thread bool<br>
</div>
<div>           aio threads=default;<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>           akamai_token_validate $test_token;<br>
</div>
<div>           akamai_token_validate_key xxxxxxxxxxxxxxx;<br>
</div>
<div>           secure_token $token;<br>
</div>
<div>           secure_token_types text/xml application/vnd.apple.mpegurl;<br>
</div>
<div>           secure_token_content_type_f4m text/xml;<br>
</div>
<div>           secure_token_expires_time 100d;<br>
</div>
<div>           secure_token_query_token_expires_time 1h;<br>
</div>
<div>           secure_token_tokenize_segments on;<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>      <br>
</div>
<div>        }<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>}<br>
</div>
<span></span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I don't know why is adding this control header: <span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">Cache-Control: private, max-age=3600, max-stale=0</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Calibri, Helvetica, sans-serif; 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="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">Thanks</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">Andrew </span></div>
</body>
</html>