FLUTTER ECOSYSTEM

shelf_cors_headers

CORS headers middleware for Shelf.

Latest version
0.1.5
30-day downloads
33.9K
Likes
41
Pub points
140

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

Shelf CORS Headers is a middleware package for the Shelf framework that simplifies adding Cross-Origin Resource Sharing (CORS) headers to HTTP responses. It enables server-side applications built with Shelf to securely handle cross-origin requests by configuring allowed origins, methods, headers, and credentials. The package integrates seamlessly into existing Shelf-based servers, providing a lightweight and configurable solution for managing CORS policies in web services across multiple platforms.

Use cases
  • Enabling cross-origin requests in Shelf-based APIs
  • Securing web services with controlled access policies
  • Supporting frontend apps hosted on different domains
  • Integrating CORS into Flutter web backends
  • Handling preflight requests automatically
Key features
  • Configurable allowed origins
  • Support for custom headers and methods
  • Automatic handling of OPTIONS preflight requests
  • Easy integration with Shelf routers
  • Flexible configuration for credentials and max age
Suitable for
  • Developers using Shelf for backend logic
  • Flutter developers building web APIs
  • Teams implementing secure RESTful services
  • Applications requiring fine-grained CORS control
  • Server-side Dart projects targeting multiple platforms
Considerations
  • Requires basic understanding of CORS standards
  • Not suitable for standalone client-side use
  • Configuration must be carefully managed in production
  • Does not include request validation beyond CORS
  • Limited to Shelf-based server environments
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add shelf_cors_headers

Categories

Dependencies

Dependency list 1 items

Source repository

Related projects