Documentation

CORS

Browse documentation

Read this page as HTML, Markdown, or structured JSON—or open the published Markdown with an AI assistant. Gemini receives the prompt through your clipboard because its signed-out page does not reliably prefill URL text; paste when the new tab opens. External assistants need the public site URL.

CORS

This recipe will help you to setup a Cross-Origin Resource Sharing pipe in your application.

First you need an amber project generated with Amber CLI or from scratch.

config/application.cr
Crystal
Amber::Server.configure do
  pipeline :api do
    plug Pipe::CORS.new
  end

routes :api do # your routes here... end end

Also see pipelines.