Skip to content

atorstling/corsware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Corsware

Build Status

Corsware is a by-the-book and feature complete implementation of the CORS Specification for Iron. Corsware supports many features, including authentication, preflight request detection, normal request decoration, allowing credentials, origins, methods and headers, exposing headers, handling null Origins and setting Max-Age.

The middleware itself is simply a standard Iron AroundMiddleware and contains no special routing logic.

Simple Example

extern crate iron;
extern crate corsware;
use corsware::CorsMiddleware;
use iron::prelude::*;
use iron::status;

fn main() {
  let handler = |_: &mut Request| {
      Ok(Response::with((status::Ok, "Hello world!")))
  };
  let mut chain = Chain::new(handler);
  chain.link_around(CorsMiddleware::permissive());
  let mut listening = Iron::new(chain).http("localhost:0").unwrap();
  listening.close().unwrap();
}

Documentation

https://docs.rs/corsware/0.2.0/corsware/

Links

Origin Spec

Origin Casemap Spec

About

CORS for Iron According to the Spec

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages