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.

Protocol "https:" not supported. Expected "http:" Error

See original GitHub issue
const agent = new http.Agent({family: 4});
axios.get("http://mywebsite.com", {
      httpAgent: agent
    })
    .then((response) => {
       console.log(response);
    })

With above code, I get below error

http_client.js:55 throw new Error(‘Protocol "’ + protocol + '" not supported. ’ + ^

Error: Protocol “https:” not supported. Expected “http:” at new ClientRequest (_http_client.js:55:11)

I am using Axios 0.15.3 and Node 6.10.0 version

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

5reactions
dotbloupcommented, May 20, 2018

dparmar74 , it is an error, it does not return a “redirect” or a target url, how did you do to solve the issue? I can’t check now, would it work to type:

const agentHTTPS = new https.Agent({family: 4});
const agentHTTP = new http.Agent({family: 4});
axios.get("http://mywebsite.com", {
      httpAgent: agentHTTP, httpsAgent: agentHTTPS
    })
2reactions
yaduecommented, May 20, 2018

@dparmar74 its an issue, breaks completly node js server and cant be even catched only if the external url configuration is incorrect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node js Error: Protocol "https:" not supported. Expected "http:"
The reason for this error is that you are trying to call a HTTPS URI from a HTTP client. The ideal ...
Read more >
[BUG] Protocol "https:" not supported. Expected "http:" #2003
I've fixed this error by unset all the proxy environment: unset http_proxy; unset https_proxy; unset all_proxy;.
Read more >
Node js Error: Protocol "https:" not supported. Expected "http:"
JavaScript : Node js Error : Protocol " https :" not supported. Expected " http :" [ Gift : Animated Search Engine :...
Read more >
Protocol "http:" not supported. Expected "https:"
In my application when I try to login with Auth0, I get the following error and the login fails. Protocol "http:" not supported....
Read more >
Protocol https not supported node js
This is caused by running your application using SSL but calling it via normal HTTP. You would need to put a check in...
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