<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/terminate-connections-with-close-connection-3mtlgaeja" -->

---
title: Terminate connections with close-connection | daily.dev
description: Ngrok has added a new close-connection action to its Traffic Policy engine, letting users terminate connections to their endpoints during on_http_request or...
canonical: https://daily.dev/posts/terminate-connections-with-close-connection-3mtlgaeja
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Terminate connections with close-connection | daily.dev
og:description: Ngrok has added a new close-connection action to its Traffic Policy engine, letting users terminate connections to their endpoints during on_http_request or...
og:url: https://daily.dev/posts/terminate-connections-with-close-connection-3mtlgaeja
og:image: https://api.daily.dev/og/posts/3MtLgaEjA.png
og:image:alt: Terminate connections with close-connection
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Terminate connections with close-connection

**[ngrok Blog](https://daily.dev/sources/ngrok)** · 2 min read · 0 upvotes · 0 comments

## Summary

Ngrok has added a new close-connection action to its Traffic Policy engine, letting users terminate connections to their endpoints during on_http_request or on_tcp_connect phases without sending a response. Originally built internally to protect ngrok.com from malicious traffic, it's now available to all users. Unlike deny or custom-response, which return status codes and optional bodies, close-connection simply drops the connection, useful for avoiding unwanted billed endpoint hours from unwanted traffic.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://ngrok.com/blog/terminate-connections-with-close-connection>

## Questions this post answers

### What does the close-connection action do in ngrok Traffic Policy?

Close-connection is a Traffic Policy action that terminates a connection to an ngrok endpoint outright, without sending any response code or body. It can run during either the on_http_request or on_tcp_connect phases and is useful for blocking unwanted traffic before it counts toward billed active endpoint hours, since no response is returned to the client.

_Teams filtering unwanted traffic at the edge can compare gateway actions like this one via daily.dev._

### What is the difference between close-connection and deny in ngrok Traffic Policy?

Deny and custom-response send a status code back to the client (deny defaults to 403 and is customizable, while custom-response lets you set both status code and body), whereas close-connection sends nothing and simply drops the connection. Use close-connection when providing a reason for rejection is unnecessary and you just want to shut the connection down.

_Developers deciding between gateway rejection strategies can track these comparisons on daily.dev._

---

Tags: [#security](https://daily.dev/tags/security), [#devtools](https://daily.dev/tags/devtools), [#api-gateway](https://daily.dev/tags/api-gateway)

[View this post on daily.dev](https://daily.dev/posts/terminate-connections-with-close-connection-3mtlgaeja)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Terminate connections with close-connection","url":"https://daily.dev/posts/terminate-connections-with-close-connection-3mtlgaeja","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/terminate-connections-with-close-connection-3mtlgaeja"},"datePublished":"2026-08-23T07:21:17.305Z","dateModified":"2026-08-23T07:29:32.533Z","description":"Ngrok has added a new close-connection action to its Traffic Policy engine, letting users terminate connections to their endpoints during on_http_request or...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/65f1611d679b55e81844a67131b245aa?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/65f1611d679b55e81844a67131b245aa?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"ngrok Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ngrok Blog","logo":"https://media.daily.dev/image/upload/s--718XXxvE--/f_auto,q_auto/v1787469610/logos/ngrok?_a=BAMAMicg0","url":"https://daily.dev/sources/ngrok"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/terminate-connections-with-close-connection-3mtlgaeja","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,devtools,api-gateway","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ngrok Blog","item":"https://daily.dev/sources/ngrok"},{"@type":"ListItem","position":3,"name":"Terminate connections with close-connection"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/terminate-connections-with-close-connection-3mtlgaeja#faq","mainEntity":[{"@type":"Question","name":"What does the close-connection action do in ngrok Traffic Policy?","acceptedAnswer":{"@type":"Answer","text":"Close-connection is a Traffic Policy action that terminates a connection to an ngrok endpoint outright, without sending any response code or body. It can run during either the on_http_request or on_tcp_connect phases and is useful for blocking unwanted traffic before it counts toward billed active endpoint hours, since no response is returned to the client. Teams filtering unwanted traffic at the edge can compare gateway actions like this one via daily.dev."}},{"@type":"Question","name":"What is the difference between close-connection and deny in ngrok Traffic Policy?","acceptedAnswer":{"@type":"Answer","text":"Deny and custom-response send a status code back to the client (deny defaults to 403 and is customizable, while custom-response lets you set both status code and body), whereas close-connection sends nothing and simply drops the connection. Use close-connection when providing a reason for rejection is unnecessary and you just want to shut the connection down. Developers deciding between gateway rejection strategies can track these comparisons on daily.dev."}}]}
```

