Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • N node-http-proxy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 482
    • Issues 482
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 102
    • Merge requests 102
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • http ... PARTY!
  • node-http-proxy
  • Issues
  • #316
Closed
Open
Issue created Oct 17, 2012 by Administrator@rootContributor

Cannot use connect.compress() middleware with http-proxy

Created by: fmarier

Looking at the middleware example that comes with http-proxy:

https://github.com/nodejitsu/node-http-proxy/blob/1df2b30e84f078d86e744601bd6fc59381a1c7b3/examples/middleware/gzip-middleware.js

I decided to write my own program which makes use of connect.compress() but is otherwise the same as the example that comes with http-proxy:

https://github.com/fmarier/node-compressed-http-proxy/blob/master/compress-example.js

Unfortunately, it doesn't work because the compress middleware looks at the headers before they are written out in order to decide whether or not a resource should be compressed. I can force compress to always compress everything by calling it like this:

connect.compress({filter: function () {return true;}})

but that's of course not a good idea since images will get gzipped too.

The result is that proxied content is never compressed by connect.compress().

Assignee
Assign to
Time tracking