﻿![]()

#### 

When you start to develop custom middleware for the Sitecore OrderCloud (create Webhooks, Integration Events) you start to think about how you can test/debug your features. Since Sitecore OrderCloud is a SaaS cloud-based platform, your middleware must be public. In other words, middleware must be accessible through the internet.

Of course, we can deploy custom middleware to Azure. It will require to build CI/CD pipeline for that. Even if you will need to test something, you have to deploy your changes to Azure. This solution looks good for QA/UAT/Stage deployments, but not for DEV, because as a developer I want to avoid any deployment to Azure before I test and debug it. I would keep everything locally. How can I do that?

We need a solution, which can make our middleware endpoint available for the public. Is there any solution for that? Yes, there is!

**Ngrok**Website: **https://ngrok.com/**[https://ngrok.com/](https://ngrok.com)

**Ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels.**

It has different paid plans, but also includes a free plan:

- HTTP/TCP tunnels on random URLs/ports
- 1 online ngrok process
- 4 tunnels / ngrok process
- 40 connections / minute

In case of a free plan, if you stop and restart the ngrok process, the ngrok URL will change. A paid ngrok account will give you a dedicated URL. It means that you have to update the Payload URL for Webhooks and Integration Events every time when you restart the ngrok process. Just keep this in mind!

Download and run a program on your machine and provide it with the port of your middleware. 

Local representation of Swagger:

![](https://www.brimit.com/-/media/images/blog/ordercloud/ordercloud_middleware_debug_1.png?h=545&amp;w=700&amp;hash=8898B090B7A2185AB3AED746F5F8D3E9)

Ngrok: ngrok http https://localhost:6001 -host-header="localhost:6001"

![](https://www.brimit.com/-/media/images/blog/ordercloud/ordercloud_middleware_debug_2.png?h=223&amp;w=700&amp;hash=BE8E99402CF9EED47FBA6B0B1920CDB7)

The middleware port can be different in your case and can be changed to yours.

Now you can copy the new created host by ngrok and try to call your custom endpoints via Postman:

![](https://www.brimit.com/-/media/images/blog/ordercloud/ordercloud_middleware_debug_3.png?h=182&amp;w=700&amp;hash=0E2AD3637F1328FBE8234FF29F3AB15C)

Ngrok also provides the web interface.

Usually, it can be accessible by this URL: [http://127.0.0.1:4040](http://127.0.0.1:4040)

![](https://www.brimit.com/-/media/images/blog/ordercloud/ordercloud_middleware_debug_4.png?h=396&amp;w=700&amp;hash=ACDABC352CC737F410AC5DA3BA4C37B8)

![](https://www.brimit.com/-/media/images/blog/ordercloud/ordercloud_middleware_debug_5.png?h=514&amp;w=700&amp;hash=D500EAE3FD67C995F407541917FBEC2A)

There are some alternatives to ngrok:

- Localtunnel.
- Serveo
- Teleconsole
- Pagekite

It’s up to you which tool you want to use. I prefer to use ngrok because it covers all my development needs.

Happy coding!

###### Author

[!\[apaliakou\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/apaliakou.jpg?h=216&amp;iar=0&amp;w=360&amp;hash=5BE96F17AE5B47F66D9F684B87773675)
Andrei Paliakou
Sitecore MVP/ Lead Developer](https://www.brimit.com/blog/author?authors=Andrei%20Paliakou)

###### More By Categories

[#E-commerce](https://www.brimit.com/blog?categories=#E-commerce)[#How-to](https://www.brimit.com/blog?categories=#How-to)[#Guides](https://www.brimit.com/blog?categories=#Guides)[Tech Talks](https://www.brimit.com/blog?categories=Tech%20Talks)[#OrderCloud](https://www.brimit.com/blog?categories=#OrderCloud)

###### More by Platform

[Data and AI](https://www.brimit.com/blog?platforms=Data%20and%20AI)[DXP](https://www.brimit.com/blog?platforms=DXP)[E-commerce](https://www.brimit.com/blog?platforms=E-commerce)[Internet of Things](https://www.brimit.com/blog?platforms=Internet%20of%20Things)[Sales and marketing automation](https://www.brimit.com/blog?platforms=Sales%20and%20marketing%20automation)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=039b3d43-73ea-4273-9378-1719f6bb6058&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=How%20to%20debug%20and%20test%20custom%20Sitecore%20OrderCloud%20middleware%20on%20your%20local%20environment&amp;kw=MIddleware,%20Sitecore,%20OrderCloud,%20Debug,%20Webhooks,%20Events&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fdebugging-sitecore-ordercloud-middleware&amp;r=&amp;lt=296&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=475023)