Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent healthcheck from being cached #1205

Merged
merged 1 commit into from
Sep 15, 2019

Conversation

guilhermearaujo
Copy link
Contributor

We run thumbor behind Cloudfront to cache the output images, without a direct, open route to the thumbor instances.

To monitor the application, we'd like to ping the health check route periodically, and since the only way for external tools to reach the server is going through Cloudfront, the health check route must no be cached.

This PR adds a cache control header with the no-cache policy to prevent Cloudfront (or whatever other service that may cache the result) from caching the response of the health check route.

@kkopachev
Copy link
Member

Curious how you made your thumbor only respond to cloudfront. In order for CF to talk to your origin, it has to be publicly accessible.

@guilhermearaujo
Copy link
Contributor Author

guilhermearaujo commented Jun 19, 2019

Using public load balancers and nginx, that re-route the requests to our applications in a private network.
We definitely could use the same nginx to inject this cache control header, what would be transparent when it gets back the CF, but I believe the application should be responsible for it.

But back to the PR, I can't understand why Travis is failing to compile pycurl 🤔
Even the master branch seems to be failing. And ideas?

@kkopachev
Copy link
Member

I think load balancers should check for service health and remove unhealthy service from pool. Doing it on cloudfront level seems weird. https://docs.nginx.com/nginx/admin-guide/load-balancer/http-health-check/

@kkopachev
Copy link
Member

In terms of travis failure. It seems that travis is randomly deciding to run a test on ubuntu xenial instead of default trusty. I made a PR to fix it #1207

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.275% when pulling 150c4e9 on guilhermearaujo:healthcheck-cache into 37c3602 on thumbor:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.275% when pulling 150c4e9 on guilhermearaujo:healthcheck-cache into 37c3602 on thumbor:master.

@cristiandean
Copy link
Contributor

Thank you @guilhermearaujo and @kkopachev!

@cristiandean cristiandean reopened this Sep 15, 2019
@cristiandean cristiandean merged commit 6e4fb04 into thumbor:master Sep 15, 2019
@guilhermearaujo guilhermearaujo deleted the healthcheck-cache branch September 16, 2019 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants