Ngrok - HTTP 400 with virtualhost - stripe-payments

I have created a url in ngrok integrated in my webhook of stripe.
But when I call that url, I receive a HTTP 400.
I have a domain name attached to my localhost url: abc.com:port and i have registered that address in my host-file. I executed ngrok like this: ngrok http port which gives me localhost:port.
What might be the issue for it?

See the documentation on how you can "ask ngrok to rewrite the Host header of all tunneled requests to match what your web server expects."
"For example, to route to your local site myapp.dev, you would run:
ngrok http -host-header=myapp.dev 80"

Related

Ngrok invalid host header

I am using ngrok to expose my react app. Due to an "invalid host header", I have re-written the host header using ngrok http 3000 -host-header="localhost:3000", which works fine.
The problem that I am encountering is that when I added in my backend node.js server, I added multiple tunnels to my ngrok.yml file :
tunnels:
first:
addr: 3000
proto: http
second:
addr: 5000
proto: http
Now, to expose react & node.js, I am using
ngrok start --all
But now I am back to the issue where I am getting the invalid host header on my front end. How do I rewrite my host header for my front end with the "ngrok start --all"?
I have managed to solve this issue for others who do encounter a similar situation.
In the ngrok.yml file, include host_header: "localhost:3000"

Chromium proxy only https

I use mac os & chromium 80.0.3987.0 and I have problem with proxy.
When I start for example: ./Chromium --proxy-server=123.123.123.123:8888 and open https page I have proxied IP but when I open http I have my own ip! What's wrong?
How to get proxy on both http & https and return error in other cases to prevent connecting from own IP? I use it also with puppeteer.
http://whatismyip.host/ - no proxy
https://whatismyipaddress.com/ - with proxy

Cannot POST to express server from domain with SSL on it

I have an existing ssl certificate through LetsEncrypt for my domain. On the same server as my site I have an express app running at port :8080. Before adding the SSL to the domain I was able to make requests to http://domainname:8080.com. Now that the domain making the requests is https it obviously can't make those requests. If I instead make requests to https://domainname:8080.com, I get no response and instead get a timeout error.
I have attempted to curl -X -POST on the server manually and it returns (35) gnutls_handshake() failed: The TLS connection was non-properly terminated. If I however run the same command pointing to the non https domain it executes correctly. I also tried installing the https modules for express and pointing it to the same certs I'm using for the domain. For all my effort I cannot get this to work. What am I missing here? I want to make requests to a port on the same server that is serving my app.
Setup a reverse proxy in my nginx site config from the domain to the ip address the express server was running on. This solved all the issues I was having.

Why are HTTP curl/Postman requests to a HTTPS server working? (Node, AWS)

I've set up a HTTPS Node server on AWS EC2 which runs on port 4443 and set up Nginx to redirect requests(port 443).
https.createServer(options, app).listen(4443, function(){
console.log("https server started at port 4443");
});
The HTTPS server is working fine, I get a secure connection on browsers and
curl https://mydomain/apiroute works
Now, when I do
curl http://mydomain/apiroute the requests still work. The same goes for Postman.
I know that I can redirect all HTTP traffic to HTTPS using something like 301 redirects but my question is, why does the server respond to HTTP API calls inspite of there being no "HTTP" server?
Additionally, I use a letsencrypt generated certificate.

Redirect http request(via browser) to local server

I have nodejs http server running on port 9000.
Now for some hostname how do i redirect normal request to this port.
Example : if I hit www.specficDomain.com in browser, it should go to www.specficDomain.com:9000.
Thanks,
Shantanu

Resources