Can I set localhost to https

Hello,

I want to set the local host to https, now when I run the app, it automatically set the server to http://localhost:10001, is there any way to set it to https://localhost:10001?
Moreover, is there any way to create an alias for the localhost such as local.test:10001. I have tried going the file host inside System 32\drivers\etc folder, and change it to local.test, but this is not working.

Thank you very much

1 Like

Hey @Nhat_Nguyen!

Could you explain what you are trying to accomplish with that?
If it’s because you want to test the external event, you can start a ngrok:


This will give you a https tunnel.
2 Likes

Hello,

I want to bypass CORS issue when calling an API. Could you give me an example of how to use ngrok with FreshDesk to call an API. Now I have the tunnel opened, but when I go to the server created by ngrok, it shows 404 error and I cannot access the app. Can you help me with using ngrok with FD app?

Thank you very much.


1 Like

So you are just trying to make an API call?
If so, are you using the Request Method and have you whitelisted the domain in manifest.json?
Ngrok is useful to test ExternalEvent.

1 Like

@Nhat_Nguyen,

I should acknowledge that we recognize that as far as local development is considered, the CLI should allow HTTP URLs when the app makes API calls via Request Method. As you might know, recent security updates have forced us to take action quickly.

We are actually working towards allowing HTTP only in the local simulation.

Coming to your question – How do I put my localhost on https

:arrow_up: Freshworks apps run on :10001, so I am assuming if you are planning to expose the same on https following is how you can do it.

  1. Just as you found out, ngrok is the best tool for this use case. You will need to download a ngrok binary file from its dashboard.
  2. You will have to use the auth token as a run command ./ngrok authtoken <get_your_auth_token_from_dashboard>. Mostly likely in the same app directory. It will help if you put your ngork binary also in the same directory. (There might be a better way to do this, I am not aware of.)
  3. As when CLI is serving your app on port 10001, open another terminal and tunnel that port to ngrok by running the following command ngrok HTTP 10001
  4. You will see in the terminal where ngrok runs producing a public URL like https://<random_string>.ngrok.io. You can use this URL for the purpose you intend to use. This URL will change as soon as you restart the ngrok CLI.

However, the above question :arrow_heading_up: doesn’t seem like you want to expose 10001 where CLI serves app to be tunneled as public URL. For example, if your API server is running on :8080, you can follow the same steps as above listed but simply put ngrok binary in your API server files directory and do $ngrok HTTP 8080.

That will mean your app should make API calls to the API server’s endpoint.

client.request.get('https://<random_string>.ngrok.io/list/puppies', options).then(function do(){..})

I hope the above information helps.

At the same time, I’d like to clarify the following confusion.

Freshworks CLI allows you to generate public URLs to test External Events. These are generally those URLs that, when receiving a POST request by any 3rd party system, will invoke a function defined by you in the serverless event handler. Usually onExternalEventHandler. Some of those 3rd party systems expect a URL on https. That is when you can use Freshworks CLI to create a webhook URL on https

2 Likes