52 questions
0
votes
0
answers
19
views
Is it possible to abort a connection before handshake in node:https module?
I'm trying to limit bots from accessing my web-server by using Cloudflare and closing any connection which is not from Cloudflare's IP addresses. However, bad bots still:
Can do service discovery ...
6
votes
2
answers
7k
views
Differences between Node standard https and node-fetch when providing a certificate
ADP's REST API requires that a SSL certificate and private key be sent with every request.
When I use the 'standard, Node.js HTTP(S) module:
require('dotenv').config()
const fs = require('fs')
const ...
0
votes
1
answer
59
views
Can't define an extension method on node's https.ClientRequest
I'm getting an error TS2339: Property 'on' does not exist on type 'ClientRequest'. while I'm defining an extension method:
export {};
import {ClientRequest} from 'https';
declare module 'https' {
...
6
votes
1
answer
875
views
Cloudflare 522 error - javascript client connecting to node server
I'm trying to connect to a nodejs https server from a apache web server hosted javascript client and I'm getting an error message : 522 - Failed to load response data: No data found for resource with ...
1
vote
1
answer
672
views
Am I inserting the .pem certficate correctly in my https.request method?
I'm making a call to an API that requires both a HTTPS Basic Authentication and certification.
The cert has a passphrase. This is my config variable:
const cert = fs.readFileSync('path.pem');
const ...
0
votes
3
answers
270
views
How to reset forEach() function if statement is matched
const downloadurl = ['url1', 'url2']
const filename = 'run.jar'
downloadurl.forEach((urls) => {
https.get(urls, (httpsres) => {
const path = `${installationdirectory}/${filename}`
...
1
vote
1
answer
873
views
using https.get instead of got causes a 308
this is a difficult question to ask because I am mystified, but let's see…
I am comparing Got with https.get, and have the following, bare simple code that works. Both Got and https.get return exactly ...
0
votes
0
answers
933
views
Using dns resolve based custom look up function takes longer for parallel requests
I am running hundreds of parallel HTTP requests for all different domains using node http module. If I understood it correctly, node http module does dns lookup using worker threads and hence number ...
1
vote
1
answer
89
views
When is Node http request actually fired?
Is node http request actually fired after req.end or after http.request ?
Context: I am using node js http module and wanted to understand what happens between:
var req = http.request(options)
// ...
1
vote
0
answers
340
views
how do I know that the socket is being re-used for request
I am using nodeJS https.Agent to make a call. I have configured the Agent such a way that it should re-use the socket.
How do I know if the same socket being re-used when I make subsequent the call ...
0
votes
1
answer
1k
views
Node Fetch resolve host like curl request
can we replicate curl resolve host in node-fetch or any other node http library.
curl https://www.example.net --resolve www.example.net:443:127.0.0.1
2
votes
1
answer
2k
views
Can't resolve 'node:http
I am doing reactjs project when I tried to run npm start
./node_modules/node-fetch/src/index.js
Module not found: Can't resolve 'node:http' in 'C:\Users\Aorat\OneDrive\Desktop\Fam-Jam-Family-...
0
votes
1
answer
5k
views
How to download an .xlsx file using nodejs
I'm trying to download a .xlsx file from a website through web scraping, I've done the entire process until I access the temporary url that the website generates for the download.
When I open the file ...
1
vote
2
answers
4k
views
How to make HTTP request with promises and retries in Node.js
I am trying to write a few wrappers around Node HTTP/S module requests, without using axios. node-fetch or any other 3rd party module.
For example, I want to have functions sendGet, sendPost, ...
1
vote
0
answers
1k
views
Nodejs HTTPS->HTTPS proxy
I'm trying to setup an HTTPS server that proxies requests to changing targets that also enforce HTTPS. this is because I want to setup an intercepting https proxy, terminate ssl, modify data and send ...
0
votes
1
answer
464
views
Get HTTP headers/body from async hook HTTPINCOMINGMESSAGE
I'm trying to get the HTTP headers and the HTTP body from the IncomingMessage instance provided by the async hook HTTPINCOMINGMESSAGE:
import asyncHooks = require("async_hooks");
import { ...
1
vote
1
answer
377
views
Send POST request with XML data in node.js: Error 400, "The request sent by the client was syntactically incorrect"
I'm trying to reproduce this Python POST request (verified working) with node.js.
It is a fairly simple POST request sending and receiving XML data.
However, I am getting The request sent by the ...
0
votes
1
answer
645
views
HTTP GET | POST from Serverless give timeout error and does not return anything
I am using aws serverless mongodb template which works fine with mongodb queries and other local processing
I want make http request to get some data for that i tried. http/http/axios/request
But it ...
1
vote
1
answer
1k
views
Socket Hangup Error In Node JS On Force API Timeout
I am using request module in Node JS (v8.12) to call a third party API. Since the API is not very reliable and due to lack of better option I am timing out the call after 2 seconds in case if there is ...
0
votes
1
answer
990
views
nodejs http-proxy not passing URL
I'm using http-proxy module and I'm trying to send the request to port 1234 and gets its reply back.
But in the apache logs I can see that request is only to /. The documentation says to use toProxy: ...
0
votes
1
answer
206
views
Change User Agent When Adding Files via urlSource in js-ipfs
I have a function to add files in js-ipfs via URL.
async function addFile(url) {
try {
for await (const file of node.add(urlSource(url))) {
console.log('Hash for ' + url.substring(url....
1
vote
1
answer
337
views
Node - Exception thrown when inserting into MongoDB (byte array)
I'm getting the error in my Express + NodeJS app. I'm using an API from CoinAPI.io, and I've had an issue in the past with getting a Byte array as a response from the API. I've looked into the issue ...
0
votes
0
answers
104
views
Cannot transfer a file in Node.js using http module
I am trying to send and receive a file in a typical client/server interaction:
Client sends over a zip file.
Server receives and saves it.
Client
const options = {
hostname: "localhost",
port:...
2
votes
0
answers
460
views
Electron successive network requests too slow
I have an electron app, with a module in which I need to send multiple (5000) successive requests to a restful Endpoint. Testing the successive requests to this Endpoint from the browser window yields ...
0
votes
1
answer
508
views
Why isn't timeout doing what I expect it to for https node module?
I have code like this:
const https = require('https');
const request = async (data, options) => {
return new Promise((resolve, reject) => {
const req = https.request(options, function(...
1
vote
2
answers
116
views
Node - Making a call to an ExpressJS route, and need to do a GET request to an API in it
I'm making a cryptocurrency dashboard for a project, and I'm completely new to Node and Express. This is what I have currently
app.get('/search', function(req,res){
res.writeHead(200, {'Content-...
2
votes
1
answer
2k
views
Result of `req.socket.authorized` is not correct using nodejs https and express [mutual authentication]
I'm trying to set up a https server with mutual authentication.
I created the key and the certificate for the server (auto-signed).
Now I use firefox to connect to the server without providing any ...
0
votes
1
answer
97
views
The best way to summarize http returns on nodejs
Have to take multiple SOAP requests and need to take back all the returns together.
What I do now is:
for (let this_target of list_of_target)
{
const req = http.request(conn, (res) =&...
3
votes
0
answers
160
views
How do I create a valid AWS token to make a request to ElasticSearch using a Cognito identity?
I want to make a request to an AWS ElasticSearch instance. The instance has access control to allow access to one or more AWS accounts or IAM users. The role represents a Cognito Identity pool that ...
4
votes
2
answers
250
views
For of loop to make HTTPS geocoding api call and on result input the coordinates into SQL database, how to get Node's HTTPS module to work?
I have 13.000 documents from MongoDB where I have address line + Postcode, im trying to make a request for each of them to Google's geocoding API and get LAT + LONG for them so I can have them appear ...
1
vote
1
answer
5k
views
How to limit size of chunk incoming from rest server on nodejs http module?
I am requesting a rest server from nodejs by using nodejs request module.
I want to cancel stream if incoming data size is out of allowed limit.the purpose here is to ensure that my network is not ...
0
votes
1
answer
2k
views
module.export and global objects
I'm confused.
Occasionally when my web api receives data it mixes the data up between objects and it appears to me that the global object in the file is actually being persistent..
Here is the basic ...
1
vote
0
answers
1k
views
How do i add ssl certificate to nodejs application to get authorised access to banking API
I am trying to use SSL secured api which Two Way SSL Authentication.
Have already created self signed certificate using keytool -genkey command and created 3 key files (selfsigned.crt , selfsigned.p12,...
0
votes
1
answer
406
views
Node.js https fails, whereas browser, `curl` & `wget` succeed?
Succeeding requests:
$ url='https://svn.tools.ietf.org/svn/tools/xml2rfc/trunk/cli/xml2rfc/data/xml2rfc.css'
$ curl "$url"
$ wget -qO - "$url"
$ python -c 'import webbrowser; webbrowser.open("'"$url"'"...
1
vote
0
answers
73
views
NodeJS response.on('data') doesn't fire when I add hook to request emit
I make https request with Node's https.request() and listen to response 'data' event:
const req = https.request('https://stackoverflow.com/', res => {
res.on('data', (chunk) => {
...
0
votes
1
answer
1k
views
How to handle http requests which are getting redirected as https using my nodejs-express app?
I am injecting some script tags in a website, with source such as http:localhost:3000/css/my-page-css.css . While its working on almost all sites, there's this particular website that is somehow ...
2
votes
1
answer
1k
views
node https-proxy pathRewrite / router
I have two instances of the same node app running on port 3000 and 4000.
I would like to have the following behavior:
https://localhost/dev ==> http://localhost:3000
https://localhost/prod ==> ...
0
votes
1
answer
388
views
Where should I put callback to return data after node https.request call?
I am trying to read the content of a request using node http native library
I want to make a POST request, which I already do successfully, but then use the saved chunks of the response to output ...
2
votes
2
answers
807
views
How can I inject a new SSL cert and key into a running Node http.Server?
I am running a secure websocket proxy to a TCP service. This uses a standard http.Server set up like:
var webserver = http.createServer( ...
0
votes
1
answer
289
views
Coalescing (combining) callbacks in node.js 6
I'm working with an AWS lambda function that has a sort of 'map/reduce' feel to it. But the 'map' part of it, that is the part that does multiple calls is async.
Using the Node 6 STD lib, is there a ...
2
votes
1
answer
1k
views
Can't get cookies with HTTP/HTTPS of Nodejs
I try with https.request but when I want access to cookie response, this don't appear on resource headers.
HTTP/HTTPS.
Example code:
let https = require('https');
https.request({
...
0
votes
1
answer
2k
views
How to get a count of the current open sockets in Node?
I am using the request module to crawl a list of URLs and would like to
limit the number of open sockets to 2:
var req = request.defaults({
forever: true,
pool: {maxSockets: 1}
});
req(...
16
votes
2
answers
34k
views
Socket hang up when using axios.get, but not when using https.get
To the best of my knowledge, I am doing the same thing using 2 different approaches:
const https = require("https");
const axios = require("axios");
let httpsAgent = new https.Agent({...
0
votes
2
answers
7k
views
nodejs req.on('end', callback) doesn't work property
I am currently buildings proxy using nodejs, which use following syntax for sending and receiving https request and response. However in my project, the response is a liitle bit larger, so typically, ...
0
votes
0
answers
672
views
Solutions for fixing node.js https library when huge amount of request need be sent concurrently
I am currently working with project that huge amount of https requests (~15K~20K per second) need be sent via node.js server (node v4.2.6). The general relevant code structure can be seen at final of ...
0
votes
1
answer
5k
views
How do I run multiple Apps on Express without routing?
I have 2 apps I am looking to add to my profile website which itself is an express app.
I want to run these apps under a /projects route such that we can have localhost/projects/app1 and localhost/...
0
votes
1
answer
1k
views
Node.js Https POST - possible error codes
My Node.js code to make https POST request is,
var req = https.request(options, function(res) {
var data = '';
res.on('data', function(chunk) {
data += chunk;
});
res.on('end', function(...
2
votes
1
answer
5k
views
node.js https POST with body-attributes - HOW?
I am trying to get a Token with my node.js server.
The code below gets executed when someone calls the REST-API of my server (within the processing of this call the server makes several calls ...
0
votes
1
answer
162
views
Issue logging in to website with AWS Lambda, cert issue
I am writing an AWS Lambda using the Node https package and my request to login to an API keeps timing out. The Lambda setup is fine:
-- once I have copied the ca-bundle.crt file into /etc/pki/tls/...
1
vote
0
answers
80
views
Node https.request to Docker API closes before full result is returned
I'm trying to make a Node https.request to a Docker daemon on a remote machine. Everything works fine when connecting to daemons with around 40 containers (running or not running) - or when I limit ...