XMLHttpRequest return POST and OPTIONS requests

0

I want to do requests XMLHttpRequest post and options the url = service is a reverse proxy and this is where you send xml requests with the server I have the following configuration but I can not find how to solve this problem. I would appreciate any suggestions ..

<!DOCTYPE html>
    <html>
        <head>
            <title></title>
            <meta charset="utf-8">
            <script src="strophe.js"></script>
            <script>
    window.onload = function(){

                    var service = 'http://192.168.0.6:5280/bosh';
                        jid = '[email protected]',
                        password = 'user2';
                    document.domain = 'im.server.com';

                    var request;

                    if (window.XMLHttpRequest) {
                        try {
                            request = new XMLHttpRequest();
                            } catch (e) {
                                try {httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                                } catch (e) {}
                            }
                    }else if (window.ActiveXObject) {
                        return new ActiveXObject("Microsoft.XMLHTTP");
                    }

                    if (!request){
                        alert("No ha sido posible crear una instancia de XMLHttpRequest");
                    }

                    request.open('POST', service, true);
                    request.setRequestHeader("Content-type", 'application/xml');


                    request.onreadystatechange = function() {
                        if (this.readyState == 4 && this.status == 200) {
                            console.log(this.responseText);
                        }
                    };

                    var connection = new Strophe.Connection(service);
                        connection.connect(jid, password, function(state) {
                            for(var statusName in Strophe.Status) 
                                if(Strophe.Status[statusName] === state) break;
                            out.innerHTML = statusName;
                        });

                    request.send(body); 
                }
            </script>
        </head>
        <body >
            <p>
                Debe mostrar "CONNECTED" espere unos segundos: 
                <b id="out"></b>
            </p>
        </body>
    </html>

the XMLHttpRequest request does not work

POST http://192.168.254.60:5280/bosh 
sendFunc    @   strophe.js:5662
_processRequest @   strophe.js:5677
_throttledRequestHandler    @   strophe.js:5823
_connect    @   strophe.js:5170
connect @   strophe.js:3051
(anonymous) @   Jchat.js:438
handle  @   jquery.js:2693
(anonymous) @   jquery.js:2468
trigger @   jquery.js:2641
(anonymous) @   jquery.js:2919
each    @   jquery.js:692
each    @   jquery.js:155
trigger @   jquery.js:2918
Connect @   Jchat.js:271
(anonymous) @   jquery-ui.js:7387
handle  @   jquery.js:2693
(anonymous) @   jquery.js:2468
    
asked by Devid 28.08.2018 в 18:51
source

0 answers