Skip to content

An ArchivesSpace plugin that adds Access-Control-Allow headers to HTTP requests using Rack middleware.

License

Notifications You must be signed in to change notification settings

UNLV-Libraries/as-cors

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

as-cors

An ArchivesSpace plugin that adds Access-Control-Allow headers to HTTP requests using Rack middleware. Huge thanks to Mark Triggs for the assist on this code.

Requirements

  • ArchivesSpace instance

Installation

  1. Download or clone this repository into the ArchivesSpace plugins/ directory..

    git clone [email protected]:RockefellerArchiveCenter/as-cors.git
    
  2. Edit config/config.rb to include the plugin:

    AppConfig[:plugins] = ['local',  'lcnaf', 'aspace-public-formats', 'as-cors']
    
  3. Restart ArchivesSpace.

Usage

Routes on which CORS headers are available can be edited by defining the AppConfig[:cors_endpoints] variable. For production use, AppConfig[:cors_allow_origin] should specify a host name, rather than the permissive wildcard *.

Edit config/config.rb to include the below default configuration.

The default configuration is:

AppConfig[:cors_allow_origin] = '*'
AppConfig[:cors_endpoints] = [
  '/version',
  '/users/:id/login',
  '/repositories/:repo_id/archival_objects/:id',
  '/repositories/:repo_id/resources/:id',
  '/repositories/:repo_id/search',
]

This gives you sufficient permissions to log in, search, and get information about a specific resource or archival object.

Contributing

Pull requests accepted!

Authors

  • Mark Triggs
  • Hillel Arnold

License

This code is released under the MIT License. See LICENSE.md for more information.

About

An ArchivesSpace plugin that adds Access-Control-Allow headers to HTTP requests using Rack middleware.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%