whatisgithub

What is cocoahttpserver?

robbiehanson/cocoahttpserver — explained in plain English

Analysis updated 2026-06-26

5,613Objective-CAudience · developerComplexity · 3/5Setup · moderate

In one sentence

An Objective-C library that lets Mac and iOS apps run a built-in HTTP server locally, with support for SSL/TLS encryption, password protection, Bonjour network discovery, WebDAV file access, and multiple simultaneous connections.

Mindmap

mindmap
  root((CocoaHTTPServer))
    What it does
      Embedded HTTP server
      Local and LAN hosting
      WebDAV file access
    Features
      SSL and TLS
      Password protection
      Bonjour discovery
      Multiple connections
    Tech
      Objective-C
      GCD concurrency
      IPv4 and IPv6
    Use Cases
      Browser to app comms
      LAN file sharing
      Remote monitoring
    Notes
      Heavily commented
      Easy to extend
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Let an iOS app expose files over the local Wi-Fi network so users can pull them from a browser without a cloud server.

USE CASE 2

Build a macOS app that accepts browser-based remote monitoring connections over a locally hosted HTTP endpoint.

USE CASE 3

Add WebDAV support to an iOS app so users can connect with Finder or any WebDAV client to browse and download files.

USE CASE 4

Announce an app's local HTTP server via Bonjour so other devices on the network can discover it automatically without knowing its IP address.

What is it built with?

Objective-CGCDBonjourSSL/TLS

How does it compare?

robbiehanson/cocoahttpserverboltsframework/bolts-objcfikovnik/shiftit
Stars5,6135,6245,545
LanguageObjective-CObjective-CObjective-C
Setup difficultymoderateeasyeasy
Complexity3/52/51/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Drop-in Objective-C library, SSL/TLS support requires a certificate, WebDAV requires additional configuration for file system path mapping.

No license information is mentioned in the explanation.

So what is it?

CocoaHTTPServer is a library that lets Mac and iOS apps run their own mini web server from inside the app itself. Instead of communicating with an external server on the internet, the app hosts HTTP traffic locally. This is useful when you want your app to talk to a browser, expose files over a local network, or accept remote monitoring connections without depending on outside infrastructure. The library is written in Objective-C and is designed to be small and easy to drop into an existing project. It supports both older IPv4 networks and modern IPv6 networks, and it handles multiple connections at the same time using a low-level Apple concurrency system called GCD, which keeps it fast and avoids blocking the app's main thread. For security, CocoaHTTPServer includes optional password protection and SSL/TLS encryption, meaning connections can be locked down with credentials and transmitted over a secure channel. It also supports Bonjour, which is Apple's system for automatically announcing a service on a local network so other devices can discover it without needing to know an IP address in advance. The library also includes WebDAV support. WebDAV is a protocol that lets remote clients treat a server like a file system, reading and writing files over HTTP. This makes it straightforward to build an app where, for example, a user connects from their computer to browse or pull files off their iPhone over the local Wi-Fi network. The code is described as heavily commented and easy to extend, so developers can modify behavior without having to understand the entire codebase first. The project has a wiki and a mailing list for questions, and the README is short because the library's scope is narrow and focused.

Copy-paste prompts

Prompt 1
Show me how to embed CocoaHTTPServer in an iOS app to serve files from the app's Documents folder over local Wi-Fi, including enabling Bonjour so Finder can discover it automatically.
Prompt 2
Add password protection and SSL/TLS to a CocoaHTTPServer instance in my macOS app. Show me the HTTPServer configuration code and where to supply the certificate.
Prompt 3
I want to add WebDAV support to my iOS app using CocoaHTTPServer so users can connect from macOS Finder over local Wi-Fi. Walk me through subclassing the request handler and enabling the WebDAV response.

Frequently asked questions

What is cocoahttpserver?

An Objective-C library that lets Mac and iOS apps run a built-in HTTP server locally, with support for SSL/TLS encryption, password protection, Bonjour network discovery, WebDAV file access, and multiple simultaneous connections.

What language is cocoahttpserver written in?

Mainly Objective-C. The stack also includes Objective-C, GCD, Bonjour.

What license does cocoahttpserver use?

No license information is mentioned in the explanation.

How hard is cocoahttpserver to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is cocoahttpserver for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.