I have a web app thats running on local. I try to use ngrok for webhooks but ngrok open the whole app to the world.(I dont want to use ngrok -auth because of some reasons.)
I want to ngrok forwards just for webhooks. For example:
Forwarding http://xxxxx.ngrok.io -> localhost:80/webhook
Is that possible for ngrok?
Or Can I re-forward ngrok request in apache? I mean;
Ngrok forwards to localhost:80 and apache detect request coming from ngrok and re-forward to localhost:80/webhook.
If you want requests to be forwarded to localhost:80/webhook, then wherever you are specifying the call-back for your service, set it as http://xxxxx.ngrok.io/webhook.
You can use https://webhookrelay.com and specify the endpoint where you want your webhook to be delivered by appending to this URL:
relay forward --bucket my-app http://localhost:80/webhook
This way your app will not be exposed to the world. Webhook Relay has two modes:
forward where it only opens one-way tunnel (nobody can get responses from your app so it's a safe way to deliver webhooks)
connect where it creates a bidirectional tunnel which is very similar to what ngrok does. It does, however, add a bit more on top of it like let's encrypt certs, basic/token auth and on-the-fly content minification.
Related
I got a problem on my app, and i'm newbie on this tehcnology ...
I have an express app on a heroku url (https://my-website.heroku.com)
I've also this project on a localhost. I want to use the prismic webhook to do some stuff when a document is published.
I try to use ngrok to:
connect it to the heroku website
detect when my /webhook route is called on the heroku app to dispatch it on my localhost server (which is the same project, but I don't know how to do this with ngrok (I used some commands but nothing happen :/ )
Can you help me please ? Thank you !
I might be misunderstanding your use case, but it sounds like what you're wanting to do is handle or detect an incoming request to your heroku app and then proxy or forward that request to your localhost.
One way to handle this would be to -- in response to the original event or request -- then make a second request like a POST request to the Ngrok URL linked to your localhost machine from your heroku app. Ngrok itself is not a real proxy server, it just links two instances of URL/DOMAIN:PORT to each other where one of these runs in the Ngrok cloud service.
So in the code you have handling or receiving the webhook request on the heroku app, you could there make, say, a POST request to the Ngrok URL for your localhost and that request would be forwarded to your localhost machine. I'm not sure what data or information you want to see in localhost but you could pass along any incoming request data in the POST body to your localhost Ngrok URL and then see the same data locally.
When I want to switch my SVN users and the server to use encrypted HTTPS protocol instead of plain HTTP, the users will also need to relocate their working copies to new https:// URLs or checkout new working copies using the new URLs. URL adjustments in scripts may also be required.
I want to make the transition from HTTP to HTTPS painless and transparent for the end users. Is it possible to implement automatic HTTP to HTTPS redirection with SVN and Apache? How?
Starting from VisualSVN Server 3.6, you can enable HTTP to HTTPS redirection via server settings. There is an option on the Network tab: Automatically redirect HTTP to HTTPS (listen on port 80). Learn more at https://www.visualsvn.com/support/topic/00144/.
Using Angular-CLI as a frontend. 4200 port
Using Express as a backend. 8080 port
Directories look like:
Application
- backend
- ...Express architecture
- frontend
-...Angular2 architecture
So I'm running two projects, two commanders, one for frontent, second one for backend. node app.js for backend (8080), ng serve for frontent (4200).
Let's assume that I have a layer in backend which returns some string.
app.get('/hello', function(req, res) {
res.send("Hello!");
}
How can I make a request from frontend to backend and get that string? I don't want to know how exactly should I use Angular2 because that's not the point. I'm asking, what technology should I use to be able connect these two (frontent and backend) sides on different ports. If I just run them and make a request from frontend, I'll get an error because it can't find /hello url.
Your request to /hello means an absolute path inside the application running the angular application, so the request goes to http://localhost:4200/hello. Your angular application just doesn't know about the express application you want to target.
absolute urls
If you want to access the hello route on the other (express) application, you need to explicitly specify this by referencing http://localhost:8080/hello.
cors
Doing it this way, the correct application is targeted, but you will likely run into CORS issues, because the browser will prevent the javascript code obtained from localhost:4200 to access a server at localhost:8080. This is a security feature of your browser. So if you want to allow the code at 4200 to access the backend at 8080 your backend can whitelist this so called origin. For details see http://enable-cors.org/ and a corresponding express middleware you could use to support cors in your backend (https://www.npmjs.com/package/cors).
Using this approach has two downsides in my opinion. First, you need a way to tell your frontend under which absolute url it can reach the backend. This must be configurable because you need different urls for dev, staging and production. You then also need a way to manage all your whitelisted urls because the frontend in production will have a different url than when running the frontend in development. This can get pretty cumbersome to handle.
proxying your backend
A better approach in my opinion is to handle this in your infrastructure by proxying the backend in your frontend application. With proxying you basically tell your frontend server that all requests to some url should be passed through to another application. In your case this could probably mean, that for example you configure a proxy for the path /api/ to proxy the application on localhost:8080. The server then doesn't try to find a url like /api/hello on your frontend application but forwards your request to localhost:8080/hello. In your angular application you then don't need to care about the url of your backend and you can then always do a request to a url like /api/some-express-route.
For this to work you need to configure your angular dev server to proxy the requests. For details on how to do this, please see the docs at https://angular.io/guide/build#proxying-to-a-backend-server. When going to production, you can do this by configuring your web server, e.g. nginx to proxy the requests.
I am trying to have links in my emails from my application register as SSL/HTTPS secure links. This helps deliverability and other things email clients may do treating links as http vs https.
Our application is using SendGrid to send emails, which also supports click tracking on our links for us. In order to do this SendGrid, and most other email sender services replace the original link we put in, which was an https://blahblah.com link with their own link, http://clicktrack.sendgrid.net or something that is not https, but rather http.
SendGrid supports "white labeling" the click tracking link with something like
http://subdomain.blahblah.com and also https version if we set it up properly. SendGrids requirements for https/ssl link are shown here
https://sendgrid.com/docs/Classroom/Build/Add_Content/content_delivery_networks.html
Basically they are asking us to setup a CDN or other server that will host our SSL certificates, terminate the SSL, and then forward the request on to their servers. Once that is in place they can "turn on" ssl on their end for our email links.
I tried setting this up in AWS CloudFront with the origin as sendgrid.net and the distribution having our SSL certificate and a route 53 CNAME pointing to our distribution. So the subdomain.blahblah.com points to distribution CDN, CDN points to sendgrid, and all should work.
Testing this though it does NOT work. If I go to the http version of subdomain it does work, CDN forwards properly. AWS support has suggested it was an issue related to host headers and the CDN not being able to validate the origin when I had a 2nd CNAME for the origin on my subdomain2.blahblah.com. That led me to remove 2nd cname and direclty put sendgrid as origin, but that hasn't worked and they haven't provided a solution yet. I get error like this..
ERROR
The request could not be satisfied.
CloudFront wasn't able to connect to the origin.
Generated by cloudfront (CloudFront)
Request ID: pl1bS3OObC6mUd2vyyhM6bNFt3xyLsfzVIqNmiPkEO7mQgJyQCn_pA==
Any ideas welcome or a different way to do this?
The issue was in behaviors I was forwarding all headers. Should NOT forward "Host" header in this situation or the origin ssl call will break as it wont match expected. AWS support did finally figure this out and recommend to me :)
I'm attempting to test a real-time Instagram stream using the Subscription API, but am having trouble setting up subscriptions for local testing.
I attempted using localhost:8080 for the callback_url and editing my /etc/hosts file (redirecting localhost to local.machine.com)
Eventually, I was able to set up a subscription to my home's IP address to receive callbacks from Instagram.
The IP address was in the form:
xxx.xxx.xxx.xx:8080
However, this morning, I was trying from a different IP address in the form xxx.xxx.x.xx:8080 which has continuously led to Instagram returning 400: Bad Request: Invalid URL
Does anybody have any insight as to what Instagram treats as a valid URL parameter for subscriptions?
I would recommend ngrok for this.
It allows you to set up a tunnel between your local machine and the internet.
With ngrok you can on the command line do like this:
ngrok http 8080
That will give you a url like this: http://something.ngrok.io. In your terminal window you can also inspect all traffic through this tunnel.