You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Holger Engels <he...@gmail.com> on 2014/09/10 20:05:44 UTC

No Access-Control-Allow-Origin Header on Attachments?

hi,

i have configured couchdb to provide CORS headers, as my gwt application is
served from a webserver (localhost at the moment) and accesses couchdb on
couchappy.

the documents are served with CORS headers. the attachments are served
without CORS headers. why?

thanks in advance, regards,

holger

Re: No Access-Control-Allow-Origin Header on Attachments?

Posted by Holger Engels <he...@gmail.com>.
hi :-)


that's it! thanks for your answer!

i didn't send the origin header with the request .. that's why i didn't get
the cors headers with the response.
i just had to append the attribute crossOrigin to my image tag ..

many thanks!!

holger





On Thu, Sep 11, 2014 at 4:45 PM, Alexander Shorin <kx...@gmail.com> wrote:

> Hi!
>
> Do you have CORS enabled / correctly set up? It actually returns CORS
> headers for attachments.
>
> http -v GET http://localhost:5984/db/doc/image 'Origin:example.com'
> GET /db/doc/image HTTP/1.1
> Accept: */*
> Accept-Encoding: gzip, deflate
> Connection: keep-alive
> Host: localhost:5984
> Origin: example.com
> User-Agent: HTTPie/0.8.0
>
>
>
> HTTP/1.1 200 OK
> Accept-Ranges: bytes
> Access-Control-Allow-Origin: example.com
> Access-Control-Expose-Headers: Accept-Ranges, Cache-Control,
> Content-Type, ETag, Server
> Cache-Control: must-revalidate
> Content-Length: 680249
> Content-MD5: 9taHrghXSXv5TlAq34I+4A==
> Content-Type: image/jpeg
> Date: Thu, 11 Sep 2014 14:42:34 GMT
> ETag: "9taHrghXSXv5TlAq34I+4A=="
> Server: CouchDB/1.6.1 (Erlang OTP/17)
>
>
>
> +-----------------------------------------+
> | NOTE: binary data not shown in terminal |
> +-----------------------------------------+
> --
> ,,,^..^,,,
>
>
> On Thu, Sep 11, 2014 at 6:19 PM, Holger Engels <he...@gmail.com> wrote:
> > what can i do about that?
> >
> > is it a matter of configuration?
> > is this the intended behaviour? or maybe .. is it a bug?
> >
> > am i doing something wrong?
> >
> > are cors headers only applied to xhr-responses?
> > are they only applied, if there's a special request header?
> >
> > any help would be very appreciated!!!
> > regards,
> >
> > holger
> >
> >
> >
> >
> > On Wed, Sep 10, 2014 at 8:05 PM, Holger Engels <he...@gmail.com>
> wrote:
> >
> >> hi,
> >>
> >> i have configured couchdb to provide CORS headers, as my gwt application
> >> is served from a webserver (localhost at the moment) and accesses
> couchdb
> >> on couchappy.
> >>
> >> the documents are served with CORS headers. the attachments are served
> >> without CORS headers. why?
> >>
> >> thanks in advance, regards,
> >>
> >> holger
> >>
>

Re: No Access-Control-Allow-Origin Header on Attachments?

Posted by Alexander Shorin <kx...@gmail.com>.
Hi!

Do you have CORS enabled / correctly set up? It actually returns CORS
headers for attachments.

http -v GET http://localhost:5984/db/doc/image 'Origin:example.com'
GET /db/doc/image HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:5984
Origin: example.com
User-Agent: HTTPie/0.8.0



HTTP/1.1 200 OK
Accept-Ranges: bytes
Access-Control-Allow-Origin: example.com
Access-Control-Expose-Headers: Accept-Ranges, Cache-Control,
Content-Type, ETag, Server
Cache-Control: must-revalidate
Content-Length: 680249
Content-MD5: 9taHrghXSXv5TlAq34I+4A==
Content-Type: image/jpeg
Date: Thu, 11 Sep 2014 14:42:34 GMT
ETag: "9taHrghXSXv5TlAq34I+4A=="
Server: CouchDB/1.6.1 (Erlang OTP/17)



+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+
--
,,,^..^,,,


On Thu, Sep 11, 2014 at 6:19 PM, Holger Engels <he...@gmail.com> wrote:
> what can i do about that?
>
> is it a matter of configuration?
> is this the intended behaviour? or maybe .. is it a bug?
>
> am i doing something wrong?
>
> are cors headers only applied to xhr-responses?
> are they only applied, if there's a special request header?
>
> any help would be very appreciated!!!
> regards,
>
> holger
>
>
>
>
> On Wed, Sep 10, 2014 at 8:05 PM, Holger Engels <he...@gmail.com> wrote:
>
>> hi,
>>
>> i have configured couchdb to provide CORS headers, as my gwt application
>> is served from a webserver (localhost at the moment) and accesses couchdb
>> on couchappy.
>>
>> the documents are served with CORS headers. the attachments are served
>> without CORS headers. why?
>>
>> thanks in advance, regards,
>>
>> holger
>>

Re: No Access-Control-Allow-Origin Header on Attachments?

Posted by Holger Engels <he...@gmail.com>.
what can i do about that?

is it a matter of configuration?
is this the intended behaviour? or maybe .. is it a bug?

am i doing something wrong?

are cors headers only applied to xhr-responses?
are they only applied, if there's a special request header?

any help would be very appreciated!!!
regards,

holger




On Wed, Sep 10, 2014 at 8:05 PM, Holger Engels <he...@gmail.com> wrote:

> hi,
>
> i have configured couchdb to provide CORS headers, as my gwt application
> is served from a webserver (localhost at the moment) and accesses couchdb
> on couchappy.
>
> the documents are served with CORS headers. the attachments are served
> without CORS headers. why?
>
> thanks in advance, regards,
>
> holger
>