request / request-promise

The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.
ISC License
4.77k stars 297 forks source link

Avoid SSL upgrade #336

Closed Mueve-Devs closed 4 years ago

Mueve-Devs commented 4 years ago

Request-Promise Version: 4.2.2

Hi!

Our team is having a bit of an issue when uploading our site to production.

We are using Docker Swarm for our deployment, so we use Docker´s internal DNS for calls between our services and our client. However, when trying to do the same operations in the production domain we get a

cause: TypeError: Failed to fetch
message: "Failed to fetch"
stack: "TypeError: Failed to fetch"
__proto__: Error
error: TypeError: Failed to fetch
message: "Failed to fetch"
stack: "TypeError: Failed to fetch"
__proto__: Error
message: "TypeError: Failed to fetch"
name: "RequestError"

Our production domain uses https because we intend to reach it from the public internet.

The thing is request-promise is actually trying to reach https://service:8505/?limit=10&page=1 when it should be http://service:8505/?limit=10&page=1. That is, without https.

We tried adding:

      followRedirect: false,
      strictSSL: false,
      insecure: true,
      rejectUnauthorized: false

to the options object, but same result.

How do we make sure request-promise doesn´t upgrade requests to https in this case? All of the HTTP requests on the site are internal. They use Docker´s internal DNS for all operations. No operation actually needs an external third party service/website, so all communications should be done over HTTP.

We tried going inside the client's container and cURL the other services. They are all reachable if the request is done over HTTP and not HTTPS.

Any ideas?

Thanks!