flowpack/cors
Composer 安装命令:
composer require flowpack/cors
包简介
CORS HTTP component (middleware) for Neos Flow
README 文档
README
Introduction
Fully featured CORS HTTP component (a.k.a. middleware) for Flow framework to allow "cross-domain" requests.
Background
This package is a implementation of a CORS middleware for Cross-Origin Resource Sharing ( see https://developer.mozilla.org/en-US/docs/Glossary/CORS). This enables the client (browser) of a webapp to perform "cross-domain" requests.
The work is partially based on the awesome github.com/rs/cors HTTP middleware for the Go programming language.
Installation
composer require flowpack/cors
(Refer to the composer documentation for more details)
The default settings enables CORS for all origins (*) in the Flow Development context. This is usually not what you
want in a production environment.
Configuration
In your package or global Settings.yaml (
see Flow framework Configuration).
Enable CORS in Production:
Flowpack:
Cors:
enabled: true
allowedOrigins:
- 'trusted-domain.tld'
Add additional allowed headers (e.g. Authorization):
Flowpack:
Cors:
allowedHeaders:
# defaults
- 'Origin'
- 'Accept'
- 'Content-Type'
# additional headers
- 'Authorization'
Note: Make sure to set all array values including the defaults (if you want to keep them) in the configuration because the Flow configuration is merged with numeric keys which can lead to unwanted effects.
Configuration reference
Flowpack:
Cors:
enabled: false
# A list of origins a cross-domain request can be executed from
# If the special * value is present in the list, all origins will be allowed.
# An origin may contain a wildcard (*) to replace 0 or more characters (i.e.: http://*.domain.com).
# Only one wildcard can be used per origin.
#
allowedOrigins:
- '*'
# A list of methods the client is allowed to use with cross-domain requests.
#
allowedMethods:
- 'GET'
- 'POST'
# A list of non simple headers the client is allowed to use with cross-domain requests.
#
allowedHeaders:
- 'Origin'
- 'Accept'
- 'Content-Type'
# Indicates which headers are safe to expose to the API of a CORS API specification
#
exposedHeaders: []
# Indicates whether the request can include user credentials like cookies, HTTP authentication or client side SSL certificates.
#
allowCredentials: false
# Indicates how long (in seconds) the results of a preflight request can be cached. The default is 0 which stands for no max age.
#
maxAge: 0
flowpack/cors 适用场景与选型建议
flowpack/cors 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22.82k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 07 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 flowpack/cors 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flowpack/cors 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 22.82k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2017-07-17