Skip to content

Cross-origin requests (CORS) headers #22

@samatjain

Description

@samatjain

Now that JXAPI supports JSON, Web applications running from within a Web browser can make requests to JXAPI directly. Unfortunately, cross-domain restrictions prevent this from working.

CORS headers tell a Web browser that it's OK to make a request to a service running on a different domain.

See enable-cors.org and the W3C specification for more information.

In theory, the minimum you need is:

Access-Control-Allow-Origin: *

This will allow any Web application running on any domain to connect to a JXAPI instance. It's a good idea to have an option where people running JXAPI instances can specify the value for this header so they can restrict access.

A complication (mentioned in the spec): Web browsers perform a "pre-flight request" to check whether a URL supports CORS. This is usually an HTTP OPTIONS request, followed by a GET/POST/whatever if access is allowed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions