Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Add CORS headers to allow Cross-site AJAX calls #5081

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 2 comments
Closed

Add CORS headers to allow Cross-site AJAX calls #5081

openstreetmap-trac opened this issue Jul 23, 2021 · 2 comments

Comments

@openstreetmap-trac
Copy link

Reporter: ikonor
[Submitted to the original trac issue database at 2.29pm, Thursday, 19th December 2013]

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 [http://en.wikipedia.org/wiki/Cross-origin_resource_sharing 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: \
[http://nrenner.github.io/leaflet-routing/ direct requests] - denied by Browser \
[http://nrenner.github.io/leaflet-routing/#http://norbertrenner.de/proxycors.php?url= remote proxy (temporary test)] - requests allowed to proxy on remote host because of CORS headers

@openstreetmap-trac
Copy link
Author

Author: ikonor
[Added to the original trac issue at 11.39am, Thursday, 23rd January 2014]

Moved the demo to a [https://gist.github.com/nrenner/8566972 gist], updated links:[[BR]]
[http://bl.ocks.org/nrenner/raw/8566972/ direct requests] - denied by Browser[[BR]]
[http://bl.ocks.org/nrenner/raw/8566972/#http://norbertrenner.de/proxycors.php?url= remote proxy (temporary test)] - requests allowed to proxy on remote host because of CORS headers

@openstreetmap-trac
Copy link
Author

Author: mmd
[Added to the original trac issue at 6.43pm, Tuesday, 19th May 2020]

YOURS project is no longer active, closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant