3.6 library(http/http_cors): Enable CORS: Cross-Origin Resource Sharing
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • The HTTP server libraries
          • library(http/http_cors): Enable CORS: Cross-Origin Resource Sharing
            • cors_enable/0
            • cors_enable/2
Availability::- use_module(library(http/http_cors)).
Source[det]cors_enable(+Request, +Options)
CORS reply to a Preflight OPTIONS request. Request is the HTTP request. Options provides:
methods(+List)
List of supported HTTP methods. The default is GET, only allowing for read requests.
headers(+List)
List of headers the client asks for and we allow. The default is to simply echo what has been requested for.

Both methods and headers may use Prolog friendly syntax, e.g., get for a method and content_type for a header.

See also
http://www.html5rocks.com/en/tutorials/cors/