mod_http_bind + ejabbered 2.1.5 + CentOS 5.5 x86_64

Is it possible to send out customized headers with the response of the http-bind?

I need to set the Access-Control-Allow-Origin header.

My website uses a JavaScript Jabber client along with http-bind to make the connections.

The web server is domain.com and the ejabberd server is xxx.domain.com, in which I am getting an error from all browsers saying the following...

XMLHttpRequest cannot load http://xxx.domain.com/http-bind/. Origin http://domain.com is not allowed by Access-Control-Allow-Origin.

Any ideas to get around this or how to set the header to allow my origin?

This is urgent and I am grateful for any input!

jowy wrote: Is it possible to

jowy wrote:
Is it possible to send out customized headers with the response of the http-bind?
Yes, it's possible to tweak ejabberd source code to provide additional headers.
jowy wrote:
I need to set the Access-Control-Allow-Origin header. Any ideas to get around this or how to set the header to allow my origin?
mod_http_bind returns that header since ejabberd 2.1.3, related to the ticket https://support.process-one.net/browse/EJAB-1168 See this example request and response using ejabberd 2.1.5:
127.000.000.001.40649-127.000.000.001.05280:
POST /http-bind// HTTP/1.1
Host: localhost:5280
User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.9.1.13) Gecko/20100916 Iceweasel/3.5.13 (like Firefox/3.5.13)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es,es-es;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Type: text/xml; charset=utf-8
Content-Length: 352
Pragma: no-cache
Cache-Control: no-cache

<body rid='133525'
      sid='c853b73bc991f42f25288245e66a2109ad719295'
      xmlns='http://jabber.org/protocol/httpbind'
      key='bcd6e31d4933e19cbf13b9332c905e2f26ea26c9'>
  <presence xmlns="jabber:client">
    <priority>5</priority>
    <c xmlns="http://jabber.org/protocol/caps"
       hash="sha-1"
       node="http://oneteam.im/caps"
       ver="B+1NRmfWP0dRroiutKItQnRwX78=" />
  </presence>
</body>


127.000.000.001.05280-127.000.000.001.40649:
HTTP/1.1 200 OK
Content-Length: 306
Content-Type: text/xml; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type

<body xmlns='http://jabber.org/protocol/httpbind'>
  <presence xmlns='jabber:client'
            from='badlop@localhost/OneTeam'
            to='badlop@localhost/OneTeam'>
    <priority>5</priority>
    <c xmlns='http://jabber.org/protocol/caps'
       hash='sha-1'
       node='http://oneteam.im/caps'
       ver='B+1NRmfWP0dRroiutKItQnRwX78=' />
  </presence>
</body>
Syndicate content