Giter Club home page Giter Club logo

Comments (6)

monkpow avatar monkpow commented on June 19, 2024

Sounds like it. Can you give me a code snippet that triggers this issue, and I'll fix the bug. Thanks!

from express-http-proxy.

btmurrell avatar btmurrell commented on June 19, 2024

@monkpow , @oyvindeh I'm hitting this issue too. I cannot tell you how to reproduce it -- express (or possibly helmet which I'm using) is loading up my req.headers by some default behavior... however, i do see where the problem in express-http-proxy is happening.

This may be a suitable fix for express-http-proxy index.js line ~83:

      if (bodyEncoding(options)) {
        var acceptEncodingHeader = reqOpt.headers[ 'Accept-Encoding'.toLowerCase() ];
        if (acceptEncodingHeader) {
          reqOpt.headers[ 'Accept-Encoding'.toLowerCase() ] = acceptEncodingHeader + ', ' + bodyEncoding(options);
        } else {
          reqOpt.headers[ 'Accept-Encoding' ] = bodyEncoding(options);
        }
      }

Edit: That is short-sighted; does not take into account unique values in this header. Various ways to do this; lodash would be my toolkit, but it does not look like you are including it.

from express-http-proxy.

monkpow avatar monkpow commented on June 19, 2024

@oyvindeh @btmurrell I'm tentative about fixing without being able to see the problem in action. If your hunch is right, you should be able to skip this chunk of code by adding

reqBodyEnconding: null

to your options.

from express-http-proxy.

oyvindeh avatar oyvindeh commented on June 19, 2024

I'm sorry, I haven't had time to write a snippet that triggers the issue. Hopefully, I'll be able to do so next week.

from express-http-proxy.

oyvindeh avatar oyvindeh commented on June 19, 2024

I have problems reproducing this outside of the environment where I get the error (and I cannot share the full code). But I can confirm that reqBodyEncoding: null does indeed work around the issue.

from express-http-proxy.

monkpow avatar monkpow commented on June 19, 2024

@oyvindeh I did find a relevant bug in the code, which is patch here 861b620. This fix is in the most recent version (0.10.1) published to npm.

Let me know if you continue to have issues. Thanks for the report and clarifications so far.

from express-http-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.