Plug adapter for the Cowboy web server
Clone or download


Build Status

A Plug Adapter for the Erlang Cowboy web server.


You can use plug_cowboy in your project by adding the dependency:

def deps do
    {:plug_cowboy, "~> 2.0"},

You can then start the adapter with:

Plug.Cowboy.http MyPlug, []

Supervised handlers

The Plug.Cowboy module can be started as part of a supervision tree like so:

defmodule MyApp do
  # See
  # for more information on OTP Applications
  @moduledoc false

  use Application

  def start(_type, _args) do
    # List all child processes to be supervised
    children = [
      Plug.Cowboy.child_spec(scheme: :http, plug: MyRouter, options: [port: 4001])

    # See
    # for other strategies and supported options
    opts = [strategy: :one_for_one, name: MyApp.Supervisor]
    Supervisor.start_link(children, opts)


We welcome everyone to contribute to PlugCowboy and help us tackle existing issues!

Use the issue tracker for bug reports or feature requests. You may also start a discussion on the mailing list or the #elixir-lang channel on Freenode IRC. Open a pull request when you are ready to contribute.

When submitting a pull request you should not update the

If you are planning to contribute documentation, please check our best practices for writing documentation.

Finally, remember all interactions in our official spaces follow our Code of Conduct.


PlugCowboy source code is released under Apache 2 License. Check LICENSE file for more information.