Access-Control-Allow-Origin header to any request made to a template that includes this tag.
- ExpressionEngine 3
- Download the latest release.
- Copy the
cross_origin_headersfolder to your
system/user/addonsfolder (you can ignore the rest of this repository's files).
- In your ExpressionEngine control panel, visit the Add-On Manager and click Install next to "Cross-Origin Headers".
The Cross-Origin Headers plugin is a single tag that you can put anywhere in your template. It might be best to put it near the top, or at least in your template comments so it's clear to anyone reading your template for the first time what's going on.
A specific domain to allow cross-origin access. The default
* will allow the request to come from any source, essentially making this a public resource.
Due to a practical restriction in implementation of the Access-Control-Allow-Origin standard, you can only specify a single origin. Therefore this plugin works when you want a fully public resource, or restricted to a single origin. If you need endpoints to be available from multiple domains, but not be public, then you will need to handle that in your server configuration. See the article Cross-Origin Resource Sharing for potential options.
Note: You must specify the protocol (
https://) with the domain, as each are treated as separate origins.
- Initial release. Boom!
You may be wondering what the rest of the files in this package are for. They are solely for development, so if you are forking the GitHub repo, they can be helpful. If you are just using the add-on in your ExpressionEngine installation, you can ignore all of these files.
- .editorconfig: EditorConfig helps developers maintain consistent coding styles across files and text editors.
- .gitignore: .gitignore lets you specify files in your working environment that you do not want under source control.
- .travis.yml: A Travis CI configuration file for continuous integration (automated testing, releases, etc.).
- .composer.json: A Composer project setup file that manages development dependencies.
- .composer.lock: A list of dependency versions that Composer has locked to this project.
Copyright (C) 2016 EllisLab, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ELLISLAB, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of EllisLab, Inc. shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from EllisLab, Inc.