WebHop.Origin 2.0.2

dotnet add package WebHop.Origin --version 2.0.2
                    
NuGet\Install-Package WebHop.Origin -Version 2.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebHop.Origin" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebHop.Origin" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="WebHop.Origin" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebHop.Origin --version 2.0.2
                    
#r "nuget: WebHop.Origin, 2.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WebHop.Origin@2.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WebHop.Origin&version=2.0.2
                    
Install as a Cake Addin
#tool nuget:?package=WebHop.Origin&version=2.0.2
                    
Install as a Cake Tool

WebHop.Origin

Serve an ASP.NET Core app through a WebHop gateway from behind NAT or a firewall, with no inbound ports. The app opens WebSocket tunnels out to the gateway, and Kestrel serves them like ordinary connections, so your middleware, endpoints, WebSockets and server-sent events work unchanged.

browser ──HTTP──▶ WebHop gateway ◀──WebSocket tunnels── your app (WebHop.Origin)
                  (public host)                          (behind NAT, no open ports)

You need a running gateway; see WebHop.Gateway.

Usage

dotnet add package WebHop.Origin
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseWebHop();   // instead of listening on a port

Start the app with the gateway's auth token, and set --urls (or applicationUrl in launchSettings.json) to the gateway's URL. That is both where the app connects and where it listens for requests:

export WEBHOP_AUTHTOKEN=<token>
dotnet run --urls https://gateway.example.com/

Or set both in code:

builder.WebHost.UseWebHop("https://gateway.example.com/", options =>
{
    options.MaxConnections = 32;
});

The app reconnects on its own when the gateway restarts. Requests arrive with the client's scheme and IP address restored from the gateway's forwarded headers.

Auth token

The app refuses to start without the gateway's auth token. It comes from the WEBHOP_AUTHTOKEN environment variable, the WebHop:AuthToken configuration key, or options.AuthToken. Keep it out of appsettings.json in source control.

Options

UseWebHop reads these from the WebHop configuration section (appsettings.json, environment variables such as WebHop__MaxConnections, …). Values set in the callback win.

Option Default Meaning
AuthToken WEBHOP_AUTHTOKEN The gateway's auth token
MaxConnections 10 Tunnels kept open; caps concurrent requests and WebSockets. The gateway may advertise a lower limit, and the smaller one wins
OriginId random How the gateway identifies this app
MaxReconnectDelay 30 s Upper bound of the reconnect backoff
KeepAliveInterval 15 s WebSocket ping interval

Notes

  • While no app is connected, the gateway answers 503. A request that gets no response within 120 s gets 504.
  • Requests carry X-Webhop-Origin-Id and X-Webhop-Request-Id; the request id becomes HttpContext.TraceIdentifier.
  • When you run the app from Visual Studio in Development, pages opened through the gateway may trigger a browser prompt about apps on your device. That is Visual Studio's Browser Link and Hot Reload script connecting back to localhost; it doesn't happen outside Development.

More

Documentation, the gateway and the webhop command line tool: https://github.com/elebree/WebHop

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 56 10/11/2026
2.0.0 64 10/10/2026