Melvin Carvalho | 16 Jan 2012 15:05
Picon
Gravatar

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

On 16 January 2012 11:27, Dan Brickley <danbri2011@...> wrote:
>
>
>
>
> On 16 Jan 2012, at 11:23, Michael Hausenblas <michael.hausenblas@...> wrote:
>
>>
>> Did you check http://enable-cors.org/#how-apache already?
>>
>
> Yup, and checked with the checktastic checker too. Those docs led me to use a virtualhost-wide 'set'
header instruction instead of a per-directory .htaccess 'add'...

From Joe

Header always set Access-Control-Allow-Origin *
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://xmlns.com/foaf/0.1/$1 [R=303]

>
> Dan
>
>> Cheers,
>>    Michael
>> --
>> Dr. Michael Hausenblas, Research Fellow
>> LiDRC - Linked Data Research Centre
>> DERI - Digital Enterprise Research Institute
(Continue reading)

Dan Brickley | 16 Jan 2012 15:11

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

On 16 January 2012 15:05, Melvin Carvalho
<melvincarvalho@...> wrote:
> On 16 January 2012 11:27, Dan Brickley <danbri2011@...> wrote:
>> On 16 Jan 2012, at 11:23, Michael Hausenblas <michael.hausenblas@...> wrote:
>>
>>>
>>> Did you check http://enable-cors.org/#how-apache already?
>>>
>>
>> Yup, and checked with the checktastic checker too. Those docs led me to use a virtualhost-wide 'set'
header instruction instead of a per-directory .htaccess 'add'...
>
> From Joe
>
> Header always set Access-Control-Allow-Origin *
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule (.*) http://xmlns.com/foaf/0.1/$1 [R=303]

I've just tried variants of these in the server-side config, i.e.

<VirtualHost *:80>
        ServerAdmin danbri@...
        ServerName xmlns.com

#       Header always set Access-Control-Allow-Origin * early
        Header always set Access-Control-Allow-Origin *

... with no change (as far as the enable-cors.org checker at least,
with http://xmlns.com/foaf/0.1/Person )
(Continue reading)

Dan Brickley | 16 Jan 2012 18:39

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

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
(Continue reading)


Gmane