React - 504 Gateway Timeout when proxying - reactjs

I'm using http-proxy-middleware to proxy some requests.
I can proxy correct some APIs but I'm getting 504 in one of them.
I believe this has something to do with the network (corp laptop).
I've run all of these commands to make sure it's all set corretly. My password has the character . (the dot). I don't think it has anything to do with it.. but we never now. I've also tried the base64 just in case but got the same result.
npm config set registry http://registry.npmjs.org/
npm config set http-proxy http://username:password#ip:port
npm config set https-proxy http://username:password#ip:port
npm config set proxy http://username:password#ip:port
npm set strict-ssl false
I'm getting this in the console:
[HPM] Error occurred while proxying request localhost:3000/produXXXXXXXXXXXX to https://XXXXXXXX [ENOTFOUND] (https://nodejs.org/api/errors.html#errors_common_system_errors)
Just replaced with XXXX because it's a corp url.
It works perfectly from postman with the same proxy server auth.
Any advice?
Thanks!

Related

Is there correct way to set Ngrok file to skip browser warning page

Here is sample of Ngrok file which I'm using within tunnel:
authtoken: somevalue
version: "2"
tunnels:
sometunellName
proto: http
addr: 5555
schemes:
- http
- https
host_header: rewrite
request_header:
add:
- "ngrok-skip-browser-warning:true"
log_level: debug
log_format: json
log: ngrok.log
Several common headers didn't give any new result.
The "ngrok-skip-browser-warning:true" header has to be added in the browser as the ngrok cloud side of things has to see it to skip the browser warning. With your config, you've added it in the ngrok cloud so only your app is seeing it.
~ an ngrok employee

React-native: unable to get local issuer certificate

request to https://registry.npmjs.org/expo-template-blank failed, reason: unable to get local issuer certificate
FetchError: request to https://registry.npmjs.org/expo-template-blank failed, reason: unable to get local issuer certificate
at ClientRequest. (C:\Users<username>\AppData\Roaming\npm\node_modules\expo-cli\node_modules\minipass-fetch\lib\index.js:97:14)
at ClientRequest.emit (events.js:210:5)
at TLSSocket.socketErrorListener (_http_client.js:406:9)
at TLSSocket.emit (events.js:215:7)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
anyone having any idea?
tired below steps:
npm config set registry http://registry.npmjs.org/
npm config set strict-ssl false
NODE_TLS_REJECT_UNAUTHORIZED =0
I had the same issue, but I am behind a Corporate proxy.
I assume setting npm config set registry http://registry.npmjs.org/ does'nt help and npm client still hits the registry over https.
So I opened https://registry.npmjs.org/ from Mozilla Firefox click the Lock icon -> Connection secure -> More Info -> View Certificate
Under certificate, to right of registry.npmjs.org, I do see our corporate Cisco Umbrella certificate, so from under Miscellaneous -> Download PEM (chain)
npm config set cafile <path_to_ca_file>\cacert.pem
Now copy the contents of the download PEM (chain) towards the end of the cacert.pem file. In case you do not have a cacert.pem already, use the downloaded PEM (chain) file as the cacert.pem
Also create an environment variable NODE_EXTRA_CA_CERTS and point it to the same cacert.pem:
Windows: set NODE_EXTRA_CA_CERTS=<path_to_ca_file>\cacert.pem
Linux: export NODE_EXTRA_CA_CERTS=<path_to_ca_file>/cacert.pem
Now try:
export init MyFirstRNApp

apache2 setup bosh for openfire

I am having issues setting up a BOSH service for a webchat. As XMPP server I'm using OpenFire and I'm already able to connect to the server using the Pidgin client. What I've done is the following:
First of all I've enabled the proxy using a2enmod proxy proxy_http. Then I went to edit the proxy.conf and added these in the end
ProxyVia On
ProxyErrorOverride On
ProxyPass /http-bind http://localhost:7070/http-bind
ProxyPassReverse /http-bind http://localhost:7070/http-bind
However, when i try to reach http://example.com/http-bind I get the following:
HTTP ERROR: 400
Problem accessing /http-bind/. Reason:
Bad Request
Powered by Jetty://
What am I doing wrong?
No any error in fact.
While you see the result, which measn that all proxy settings of yours are correct, as the http-bind needs to accept the POST(xml format) data as its true request, it is why the openfire server return 404 to you.

Connecting a secured websocket on Google Appengine frontend with managed VM with nodejs runtime

I've trouble in connecting to a wss secured socket server via google appengine frontend with managed VM support.
buy default google exposes only port 8080 in docker image google/nodejs-runtime, Even if expose port 8443 in Dockerfile like below i can connect only to http://localhost:8080 not https://localhost:8443
FROM google/nodejs
WORKDIR /app
ADD package.json /app/
RUN npm install
ADD . /app
EXPOSE 8443
CMD []
ENTRYPOINT ["/nodejs/bin/npm", "start"]
Still i can see port 8080 include in the container
"/nodejs/bin/npm start 8443/tcp, 0.0.0.0:8080->8080/tcp
If i log in to my managed vm instance and run the container image with
docker run -d -p 8443:8443 nodejs.default.wss-check:latest
and try
$curl https://localhost:8443
I get curl: (60) SSL certificate problem: unable to get local issuer certificate, It looks like its connecting but i've to use realdomain name
I've created a issue in github aswell https://github.com/GoogleCloudPlatform/appengine-nodejs-quickstart/issues/13, but not that helpful.
Same set up works like a charm in normal compute instance. but it doesn't auto scale.
Any help on this issue will be appreciated.
The reason you can't curl to https on localhost (curl: (60) SSL certificate problem: unable to get local issuer certificate) is because "localhost" is unknown to any CA. You need to run curl -k https://localhost:8443 to get it to ignore the lack of a certificate for localhost.
Looks like currently Google Managed VM supports Websocket connection only on JAVA
Even if you try websocket connection on with nodejs on GMV it defaults to polling transport. if you wanna see this in live you can use set socket transports, deploy to live and look in to console- network and see which transport its using!
socket.set('transports', [
'websocket'
, 'flashsocket'
, 'htmlfile'
, 'xhr-polling'
, 'jsonp-polling'
]);
We have to wait untill google implements websocket support in Managed VM. If anyone get this working on GMV, Please comment here :)

appcfg appengine 502 Proxy error in localhost

I am trying to upload some data to my local datastore in appengine.
The command I am using is the next one:
appcfg.py upload_data --config_file="C:\config.yml" --filename="C:\mycsv.csv" --url=http://localhost:8888/remote_api --kind=MyEntity
The problem is that I'm working behind my company proxy and I am getting the next ERROR even trying to connect to the localhost server:
Error Code: 502 Proxy Error. The ISA Server denied the specified Uniform Resource Locator (URL). (12202)
It seems the authentication is ok, but somehow the proxy tries to filter my connection to my own computer.
Some ideas about how can I solve this?
Thanks.
Remove/disable proxy settings of your network then try the above command.
I was facing the similar issue and this issue resolved when i disable my proxy settings.

Resources