[foaf-dev] Enabling CORS on xmlns.com for browser .js access to FOAF and WOT vocab documentation

Dan Brickley danbri at danbri.org
Mon Jan 16 12:39:12 EST 2012


Relaying from #dig IRC, ...

It seems it is (sort of?) working, if you look yourself at the
headers. However the checker at http://enable-cors.org/ doesn't like
the 303 URLs for some reason.

The secret seems to be the 'always' parameter in Apache config language:

	Header always set Access-Control-Allow-Origin *

We're not yet confirmed that the header is enough to make the doc
accessible, but seems like progress at least...

cheers,

Dan

IRC chat:

18:08 presbrey: did you put the always?
18:08 presbrey: danbri, apache config very much trial and error
18:09 presbrey: might work at either level
18:09 presbrey: I have it in htaccess on my test server
18:11 presbrey: just add the 'always', leave your redirect scheme as
your users prefer. that was just quick for my testing
18:13 presbrey: ah I see its now working danbri
18:13 presbrey: * Connected to xmlns.com (75.101.157.128) port 80 (#0)
18:13 presbrey: > GET /foaf/0.1/Person HTTP/1.1
18:13 presbrey: < HTTP/1.1 303 See Other
18:13 presbrey: < Date: Mon, 16 Jan 2012 17:13:14 GMT
18:13 presbrey: < Server: Apache/2.2.14 (Ubuntu)
18:13 presbrey: < Access-Control-Allow-Origin: *
18:13 presbrey: < Location: http://xmlns.com/foaf/spec/
18:13 presbrey: so you found it then, nice
18:31 danbri: oh, is it?
18:31 danbri: I got http://xmlns.com/foaf/0.1/Person seems not yet to
be CORS-enabled.  from http://enable-cors.org/
18:32 danbri: but yes I see it working too, when telnetting
18:32 presbrey: you may need additional headers added
18:32 danbri: I added the 'always' (in .htaccess and server-wide...)
18:33 presbrey: the Allow-Origin seems to be showing
18:33 danbri: yeah, which is progress at least!

Vulgar telnet checker:


TellyClub:~ danbri$ telnet xmlns.com 80
Trying 75.101.157.128...
Connected to xmlns.com.
Escape character is '^]'.
GET /foaf/0.1/dnaChecksum HTTP/1.1
Host: xmlns.com

HTTP/1.1 303 See Other
Date: Mon, 16 Jan 2012 17:32:26 GMT
Server: Apache/2.2.14 (Ubuntu)
Access-Control-Allow-Origin: *
Location: http://xmlns.com/foaf/spec/
Vary: Accept-Encoding
Content-Length: 309
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>303 See Other</title>
</head><body>
<h1>See Other</h1>
<p>The answer to your request is located <a
href="http://xmlns.com/foaf/spec/">here</a>.</p>
<hr>
<address>Apache/2.2.14 (Ubuntu) Server at xmlns.com Port 80</address>
</body></html>
Connection closed by foreign host.


More information about the foaf-dev mailing list