GithubHelp home page GithubHelp logo

Http headers about proxy-agents HOT 3 CLOSED

tootallnate avatar tootallnate commented on July 20, 2024
Http headers

from proxy-agents.

Comments (3)

TooTallNate avatar TooTallNate commented on July 20, 2024

Can you show some example code please?

from proxy-agents.

razbomi avatar razbomi commented on July 20, 2024

Ok some context ... I am constantly pained with a corporate proxy thing. We have a bunch of angular thingies so angular-cli is the flavour of the month here. Hence I am running ng serve --proxy-config proxy.conf.js. The code in proxy.conf.js is something along these lines.

const HttpsProxyAgent = require('https-proxy-agent');
const PROXY_CONFIG = [
  {
    agent: new HttpsProxyAgent(process.env.HTTPS_PROXY || process.env.HTTP_PROXY),
    context: [
      "/api",
      "/uat",
      "/meow"
    ],
    target:  {
      host: "my.awesome.api.com",
      protocol: "https:",
      port: 443
    },
    secure: false,
    changeOrigin: true,
    logLevel: "debug"
  }
]

module.exports = PROXY_CONFIG;

So now if you make a request using curl, through the angular cli server which for me is on localhost:4200/api with an Authorization header, that header will not make it to the server hosting the https://my.awesome.api.com/api.

Now admittedly I haven't investigated properly what the angular cli thingie is actually doing with agent. However when I was reading through the code I made the assumption that headers from the original request are possibly ignored eg.

var headers = Object.assign({}, proxy.headers);

To be honest, I only read through the code... I'd be happy to write a test to prove it and/or raise a pull request if it is on this side instead of on the angular cli thingie

from proxy-agents.

TooTallNate avatar TooTallNate commented on July 20, 2024

This module has gone through a large refactor and modernization. I am closing this issue as a bit of house cleaning. If you feel that this issue still exists in the latest release, feel free to open a new issue.

from proxy-agents.

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.