Bad Gateway Ngrok? - ngrok

I am trying out the dev for FB Messenger bots and need a web hook. I have been trying Ngrok, but I keep getting a 502 bad gateway error.
I tried ./ngrok http 3000 and I used the url http://a0b3abcb.ngrok.io as a callback, but it refuses saying HTTP bad gateway.
What is wrong and how do I fix this? MAC OSX.

Found a fix.
I ran a Django server on port 8000 (default) and ran NGROK on port 8000 instead of port 80. Basically, if the port # is the same on the server and Ngrok, then you have a solution.

Related

Trouble making http request from lighttpd server to pm2 server

Background:
I have my personal website running on a lighttpd server on my raspberry pi. I have that server’s port (80) forwarded so it can be accessed publicly.
I’m in the process of making a project, and I want a node.js service to make requests to from the lighttpd server. I set up pm2 so the node.js server is always running. I have that port forwarded too (5000). I've verified that this server is working via postman and the browser
Problem:
I'm receiving the following error when making requests:
has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space private.
Of note; I have Access-Control-Allow-Private-Network:true in the response header and Access-Control-Request-Private-Network:true in the request header. The only other solution I've found that might fix this is getting an SSL cert for the lighttpd server and using https for it, however I'm struggling setting that up to see if it would work
Questions:
Would getting an SSL cert for lighttpd allow me to make requests to my pm2 server?
Is there a different solution?
How secure is this setup? I don't expect a lot of traffic...

How to can http services from https server

I have apache server(Frontend code) running on 80 port with https secure(SSL is configured). Backend server is nodejs and it is configured on 3000 port. When I tried to call services from https to http i.e. Apache(port 80 ssl configured) to Nodejs (port 3000 non-ssl) it is giving showing failed with status as "net::ERR_SSL_PROTOCOL_ERROR".
This may have something to do with Same Origin policy.
Please see that answer: HTTP Ajax Request via HTTPS Page.

IISExpress with tunneling tool: The request hostname is invalid

I started a very simple ASP.net web api app. on port 8080.
I used ngrok as a tunneling tool to get a forwarding ip address:
Using postman I posted to the local server with the following request
http://ccf7e40b.ngrok.io/Bot/messages
and get the error: "HTTP Error 400. The request hostname is invalid.". However replacing the forwarding url with localhost:8080 would work.
I have seen several other posts with the same error messages get resolved by adding a binding line in Documents\IISExpress\config\appilcationHost.config to bind to a specific port. However I'm already running on 8080 port.
I'm using Visual Studio 2017.
You have to use modified hostheaders. So in your case, it should work with:
ngrok.exe http -host-header=rewrite localhost:8080

Should I use nginx as a proxy for WAMP?

guys!
I build a chat application based on WebSocket. As backend I use PHP and nginx as a proxy for WebSocket connection.
Searching about PHP libs for WS gave me Ratchet. This tools support WAMP protocol. Something about it: http://wamp-proto.org/why/
Well, I've decided to use this protocol - it seems useful. I tuned nginx for proxy WebSocket connections in standard way. And for common using WebSocket at frontend/backend - all is ok.
But, if I start use WAMP at backend and try to use autobahn.js for WAMP at frontend, I catch 426 No Sec-WebSocket-Protocols requested supported as response every time. At PHP I see that connection from nginx is not receiving. So, as I understood, nginx doesn't process connection with WAMP subprotocol in right way.
So, I don't understand, should I use nginx as a proxy for WAMP? WAMP is just a subprotocol for WebSocket, but doesn't work for me.
Does anybody knows where problem is?
Seems like Nginx isn't forwarding the WebSocket subprotocol announced by the client to the backend WAMP router.
Try adding this to your Nginx conf:
proxy_set_header Sec-WebSocket-Protocol $http_sec_websocket_protocol
See: https://stackoverflow.com/a/36506746/884770

accessing port 8443 with http in tomcat

I have a Tomcat 6.x or 7.x web application server running on a webserver listening on port 8443.
Why is it that when I access http://:8443, I am
prompted to download a file of the format application/octet-stream from any browser from any platform?
When I access http://:443 I get a 400 Bad Request.
Is there anyway to configure Tomcat to yield a 400 Bad Request error code if a user attempts to access the SSL port via http ?
It's because you need to type https:// beforehand :D I just had the same problem!
I think some forwarding is needed to ensure https is used.

Resources