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

Cache does not work with images #16

Open
JMLX42 opened this issue Jun 12, 2016 · 1 comment
Open

Cache does not work with images #16

JMLX42 opened this issue Jun 12, 2016 · 1 comment

Comments

@JMLX42
Copy link

JMLX42 commented Jun 12, 2016

Hello,

I'm trying to use this module to proxy and cache some images coming from external services.
It works when I don't set the cache option.

exports.proxy = function(req, res, next)
{
    if (!req.headers['referer'])
        return res.status(400).send();

    var ref_parts = url.parse(req.headers['referer'], true);
    if (ref_parts.host != config.hostname)
        return res.status(400).send();

    return requestProxy({
        cache: redis.createClient(),
        cacheMaxAge: 3600,
        url: req.query.url
    })(req, res, next);
}

The very same code works for other requests/mime-types such as plain HTML or text.

How can we solve this?

@JMLX42 JMLX42 changed the title Does not work with images Cache does not work with images Jun 12, 2016
@j
Copy link

j commented Jul 20, 2018

@promethe42 try: const redisClient = redis.createClient({ return_buffers: true });

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

No branches or pull requests

2 participants