Opened 6 years ago

Last modified 5 years ago

#5081 new enhancement

Add CORS headers to allow Cross-site AJAX calls

Reported by: ikonor Owned by: osm@…
Priority: minor Milestone:
Component: yours Version:
Keywords: Cc:

Description

It seems like yournavigation.org is still the only Routing API that is open (no API key) and has a simple, straightforward API. So it's ideal for testing and demo purposes.

It would be even simpler to use if there was no need for a proxy with JavaScript-only clients. Adding CORS (Cross-origin resource sharing) response headers to the php scripts would allow direct requests from JavaScript (except older IEs):

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: X-Yours-client");

My use case is a demo hosted on GitHub gh-pages:
direct requests - denied by Browser
remote proxy (temporary test) - requests allowed to proxy on remote host because of CORS headers

Change History (1)

comment:1 Changed 5 years ago by ikonor

Moved the demo to a gist, updated links:
direct requests - denied by Browser
remote proxy (temporary test) - requests allowed to proxy on remote host because of CORS headers

Note: See TracTickets for help on using tickets.