Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Openshift adds cache-control private?

My flask python service on Openshift Origin is adding a Cache-Control: private. My cache server does not make cache because this. How can I remove this from service?

I Have added this configuration but has no effect:

apiVersion: v1
kind: Route
metadata:
  annotations:
    haproxy.router.openshift.io/disable_cookies: 'true'

When I performa a curl the header still returns:

$ curl -I http://api.example.com/
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 87160
Cache-Control: max-age=300
Vary: Accept
Expires: Fri, 07 Apr 2017 18:09:44 GMT
Set-Cookie: OPENSHIFT_EDGE_example-api_example-api_SERVERID=8326069cf7d473e9305855a9a08aaef4; path=/; HttpOnly; Secure
Cache-control: private
Connection: keep-alive
like image 372
LuisComS Avatar asked Jul 29 '26 02:07

LuisComS


2 Answers

At a guess the haproxy router in OpenShift adds this because by default it uses a cookie to implement sticky sessions, to try and ensure traffic from a user goes back to same application instance.

  • https://docs.openshift.com/container-platform/3.4/architecture/core_concepts/routes.html#haproxy-template-router

As a result, the cookie being returned would be specific to the user.

There is a way of changing how haproxy manages this, but not sure of details of what you need to change.

like image 113
Graham Dumpleton Avatar answered Jul 30 '26 17:07

Graham Dumpleton


Graham is correct, this is a sticky session issue.

Remove the haproxy.router.openshift.io/balance: roundrobin annotation from the route, and the Cache-Control: private goes away.

like image 25
DomQ Avatar answered Jul 30 '26 16:07

DomQ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!