question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proxy Setting via Environment Variables?

See original GitHub issue

I have a question.

Instead of providing proxy information via the package.json, is it possible to achieve exactly the same thing by providing this information directly into environment variables?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:28
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ksmithutcommented, Dec 5, 2018

I was able to get this to work with a custom src/setupProxy.js file with the following contents:

const proxy = require('http-proxy-middleware')
const pkg = require('../package.json')
const target = process.env.PROXY || pkg.proxy

module.exports = app =>
  target &&
  app.use((req, res, next) =>
    req.accepts('text/html') ? next() : proxy({ target })(req, res, next)
  )

1reaction
Timercommented, Nov 8, 2018

I suggest you file a question on Stack Overflow, you can link it here!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set up proxy using http_proxy & https_proxy ...
The http_proxy and https_proxy environment variable is used to specify proxy settings to client programs such as curl and wget . ALSO READ:...
Read more >
Setting Environment Variables for Proxy Servers
1. Click Start > Control Panel > System ; 2. Click the Advanced Systems Settings ; 3. Click Environment Variables ; 4. In...
Read more >
Set http_proxy environment variable with domain user and ...
I've been trying to set http_proxy and https_proxy environment variables in windows using command prompt to be able to access my company's web ......
Read more >
Working with Proxies - Chef Software
Open System Properties. Open Environment Variables. Open System variables. Set http_proxy and https_proxy to the location of your proxy server.
Read more >
What's the 'right' format for the HTTP_PROXY environment ...
This is because that variable can be injected by a client using the “Proxy:” HTTP header. If you need to use an HTTP...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found