-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Feature Request - Caching #878
Comments
Perhaps we could use https://github.com/lox/httpcache |
Love this, but it might be a pain to maintain. IMHO, we could use existing caching solution like Varnish and Nginx. I don't know how to configure this at this point (Docker Swarm Mode here). We just need to know how to run this. Any docker-compose setup anyone ? |
+1 |
@rrichardson As a start a memory limit should be enough to configure such middleware. A HTTP backend can control caching via response headers. Things could go wild when you need to adjust hashing, purging, cookie. |
👍 to simple caching that just has a single memory limit setting and honours |
Via a docker stack, it would be nice the have Varnish between the webapp and Traefik. |
My use case would be traefic with let's encrypt and multiple dockerised web
apps behind it and traefic generating the config automatically.
I'd like to cache recently used static assets like I can in nginx. I can't
put varnish behind because it would require something to route requests to
the right apps, I can't put varnish in front because everything from
traefic forward is Https.
…On 14 Sep 2017 02:02, "Pascal Andy" ***@***.***> wrote:
Via a docker stack, it would be nice the have Varnish between the webapp
and Traefik.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#878 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAqQm6Ltjkx0xEZIxA3e2bUdwexVIx1ks5siHslgaJpZM4K5idM>
.
|
Having cache we could have a Grace Period, in which Traefik would serve static pages even if the backend is down. This would eliminate the need for having Nginx/Varnish in front, at least in my scenario. |
just some 2 cents, that would be relevant for my use-cases and may have already been mentioned in some way in a previous post.
|
I would also really really appreciate, if Traefik would be able to cache! Please implement this :) For the meantime, if you look for a simple but fully working example how to use Nginx as a cache in front of Traefik, have a look at https://github.com/jonashackt/traefik-cache-nginx-spring-boot |
This is a much-needed feature for production environments. |
I would also like to +1 this feature request. |
I agree with @joeldeteves. I'm currently testing Traefik without anything in front of it, and preparing for production use, but the cache part is important. With nginx in the front, we can easily handle cache of static content right there. |
Are we sure Traefik is the right place to do this? Varnish and Nginx do cache out of the box. Should we instead work on a great |
I'm definitely not sure about it, but it would be great with a simple way to activate caching directly in the load balancer, just like nginx. I'm not sure how it would work with a docker service in-between handling the cache, so I'd appreciate any examples or templates for that aswell. As long as it's easy to use I'm happy. :) |
@pascalandy IMO the power of traefik comes from labels. Being able to define caching behavior based on labels would be extremely powerful. |
I have no idea as well.
|
This comment has been minimized.
This comment has been minimized.
Seriously, enough. This issue is open since 2016. There are a lot of subscribers like me that have notifications turned on. And most comments say the same thing. It is understood that this would be a killer feature, awesome feature, that YOU also want this, etc etc. So I suggest unless you have a PR or something constructive to bring to this discussion, just use the thumbs up on the original post and push the subscribe button to get an update of when this might be closed. |
Cool feature! Must be configurable by file type, origin, disable logging and passing other header rules
|
Yep - originally requested back in 2017 and lots of chat in 2018. Still, no word from the Official Team 😢 Would love some acknowledgement .. even if it is a "nope". |
They decided it's a
|
Sorry @pascalandy - i was meaning via some text/post comment-update. Not just a tag that feels like it's lost in the backlog. I should have been more verbose with my comment, above. Sorry if that came off as rude :( soz. |
Don't know if this helps everyone, but I built a configurable nginx proxy container which can easily be used in in conjunction with Traefik. Set the Seems to work flawlessly in my swarms. |
@PureKrome well its very complex (it's much more than @gp187 code snippet shows). Giving that it's far from being core feature I'm not surprised it's still not there. Just use nginx, varnish or cdn (if possible) |
Hi, Is it possible to implement caching fonctionnality ? |
Greetings! There is a plugin for HTTP caching, while it's file-based, there are certainly opportunities for other implementations to be built which use fast data stores (Redis, Memcached, etc). https://pilot.traefik.io/plugins/270947801855164928/simple-cache |
Another plugin will be release soon with better integration based on my cache system called Souin |
Hello, any news for caching ? |
I'm currently working on the RFC support and shared cache support too. Then I'm waiting for the support of unsafe lib to publish my cache system as plugin |
We solved the caching (via headers) of assets in Traefik for our purposes. We have all the images in "/media/cache" and all the CSS/JS in the "/assets/" folder. Then all you have to do is create more host definition and define custom headers for one of them. (Traefik sorts route priority by length of rule "DESC") My app labels: labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-public"
# Static content
- "traefik.http.routers.my-app-static.rule=Host('my-app.com') && PathPrefix(`/assets/`, `/media/cache/`)"
- "traefik.http.routers.my-app-static.entrypoints=https"
- "traefik.http.routers.my-app-static.tls=true"
- "traefik.http.routers.my-app-static.middlewares=cache-headers"
# Dynamic content
- "traefik.http.routers.my-app.rule=Host('my-app.com')"
- "traefik.http.routers.my-app.entrypoints=https"
- "traefik.http.routers.my-app.tls=true"
- "traefik.http.services.my-app.loadbalancer.server.port=80" My Traefik service labels: labels:
- traefik.http.middlewares.cache-headers.headers.customresponseheaders.Cache-Control=public,max-age=2592000 You can define your own hosts regex for check jpg, css, js etc. Works great together with Traefik GZIP middleware! 🚀 |
@misaon Your solution doesn't fix the Træfik problem that tries to fetch service instead of serving app cache. Then it's not RFC compliant due to missing TTL, Vary and other headers defined in the RFC |
@darkweak sure, this not solve issue for all peoples in this topic, but you can determine assets by route and set them needed headers. This example is for our purposes. We still waiting for RFC implementation on Traefik side. |
It'll be implemented as soon as Træfik supports go unsafe library for plugins then I'll submit my cache system as official plugin. ATM it works out of the box as standalone software. |
@darkweak wow - the Souin app looks great! |
Just my 2 cents, I’d love Varnish integration with Traefik via some middleware, but I really don’t want the Traefik team to reinvent the wheel and re-implement the caching logic/language/config within Traefik itself! |
@JaneJeon it would be supported using Souin as Træfik plugin when they will fix this yaegi issue traefik/yaegi#1172 |
Hello there, little update about this, Souin is now available as træfik plugin here 🎉. You can now use an efficient HTTP cache system without any changes on your stack. |
Would love to see this in community edition since it's a really useful and important feature. |
any updates? |
This is an enterprise feature so, unfortunately, it seems that you have to buy Traefik enterprise to get caching functionality. Don't hesitate to tell me if I'm wrong. |
@tigerblue77 you can use Souin as Træfik plugins (v2/v3), it's free and will stay free forever. https://github.com/darkweak/souin |
It would be nice to have caching without having to add additional moving parts to our infrastructure. Some features I'd like to see : Cache by annotation/self-config. LRU with max memory/item limit. Max duration.
It seems like it would be fairly simple to add a simple LRU caching middleware to Traefik. The tricky part would be the configuration side, being able to specify which paths, duration, max mem, etc..
Has this been discussed?
The text was updated successfully, but these errors were encountered: