Ngrok and Rest API

Discussions relating to the REST API of Jiwa 7.

Ngrok and Rest API

Postby SBarnes » Fri Jun 19, 2020 4:11 pm

Interesting thing I have discovered whilst attempting to setup ngrok (https://ngrok.com/) with the rest api to come back to local host, when you get the metadata page to come up which it will do quite happily any link you click on is unfortunately not going to work because the URLs have been derived to include the port number so http://ZZZZ-----.ngrok.io gets translated to http://ZZZZ-----.ngrok.io:81 if 81 is the port you are bound too.

Is this likely to be an issue with routes themselves on the api or is this just a symptom of the ServiceStack plugins that generate the web interface?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Ngrok and Rest API

Postby Scott.Pearce » Fri Jun 19, 2020 5:35 pm

Sounds like a problem with ngrok to me.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Ngrok and Rest API

Postby Mike.Sheen » Fri Jun 19, 2020 5:51 pm

It does look like ngrok isn't rewriting the URL properly.

ngrok is really acting like a proxy, and whilst it is rewriting the URLs in responses, it's not considering the port number - which is a valid part of the URL.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Ngrok and Rest API

Postby SBarnes » Fri Jun 19, 2020 6:22 pm

I'd say you are right if you go to page source its replaced local host with ngrok url but not the :81.

I am looking at being able to work with incoming webhooks for development locally, given I've already gotten it to work ap.net webhook receivers I think it should work with the api as well without a problem.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Ngrok and Rest API

Postby Mike.Sheen » Fri Jun 19, 2020 7:24 pm

SBarnes wrote:I'd say you are right if you go to page source its replaced local host with ngrok url but not the :81.


Yes - I should have mentioned I went to the effort of creating an ngrok account, downloading the windows app and testing it out with a locally running Jiwa self hosted REST API service on port 81 as you described - and I could see it was rewriting the URL's, but it was including the port number of the base URL when I think it shouldn't have been.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Ngrok and Rest API

Postby SBarnes » Fri Jun 19, 2020 8:20 pm

So long as it will redirect to local host which I believe it should for an api call it should be ok for testing incoming hooks, the other is an annoyance that I can live with, fortunately one little neat feature that ngrok says it does is it creates a https link through to straight http as well which is good in a case of any platforms where https is mandatory for their webhooks.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to REST API

Who is online

Users browsing this forum: No registered users and 1 guest

cron