Jeff Elsloo created TC-309:
------------------------------

             Summary: No Cache-Control on images
                 Key: TC-309
                 URL: https://issues.apache.org/jira/browse/TC-309
             Project: Traffic Control
          Issue Type: Bug
          Components: Traffic Ops
            Reporter: Steve Malenfant
            Priority: Trivial


>From GH issue #962:

This was observed during 1.3.0RC6 testing. The headers are different in 1.1.6 
(actually not cache-control headers).

Images didn't show up sometimes, high latency to display the Health->Table View.

Is this a byproduct of using localhost connection (through Vagrant) ?

But doesn't seems like this code changed along the way...

{code}
Request URL:https://127.0.0.1:4443/images/graph.png
Request Method:GET
Status Code:200 OK

Remote Address:127.0.0.1:4443
Response Headers
view source
Accept-Ranges:bytes
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept
Access-Control-Allow-Methods:POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin:http://localhost:8080
Cache-Control:no-cache, no-store, max-age=0, must-revalidate
Connection:keep-alive
Content-Length:892
Content-Type:image/png
Date:Fri, 22 Jan 2016 15:03:36 GMT
Last-Modified:Fri, 22 Jan 2016 13:14:28 GMT
Server:Mojolicious (Perl)
{code}

Logs
{code}
10.0.2.2 - - [22/Jan/2016:15:11:55 +0000] "GET 
/api/1.1/traffic_monitor/stats.json?data_type=json HTTP/1.1" 200 73
10.0.2.2 - - [22/Jan/2016:15:11:55 +0000] "GET /images/good.png HTTP/1.1" 200 
617
10.0.2.2 - - [22/Jan/2016:15:11:55 +0000] "GET /images/graph.png HTTP/1.1" 200 
892
10.0.2.2 - - [22/Jan/2016:15:12:00 +0000] "GET 
/api/1.1/traffic_monitor/stats.json?data_type=json HTTP/1.1" 200 73
10.0.2.2 - - [22/Jan/2016:15:12:02 +0000] "GET 
/api/1.1/traffic_monitor/stats.json?data_type=json HTTP/1.1" 200 73
10.0.2.2 - - [22/Jan/2016:15:12:02 +0000] "GET /images/good.png HTTP/1.1" 200 
617
10.0.2.2 - - [22/Jan/2016:15:12:02 +0000] "GET /images/graph.png HTTP/1.1" 200 
892
{code}

By default, the cdn.conf contains an entry showing

{code}
  cors => {
    access_control_allow_origin => 'http://localhost:8080'
  },
{code}

Comment those lines and this will disable the Cache-Control headers for all 
files. Use only if you are not going through a proxy. Enjoy the fast UI again.

The Cache Control should be changed for static files. These should probably be 
set to something like max-age=86400. When doing development, these should be 
disabled so one doesn't get frustrated not seeing updates made...

{code}
/opt/traffic_ops/app/public/css
/opt/traffic_ops/app/public/images
/opt/traffic_ops/app/public/js
/opt/traffic_ops/app/public/theme
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to