in Education by
I have a proxy that uploads a fire to the Amazon S3 Server. This proxy is made using NodeJS and my webpage is hosted on a Tomcat server. So to make a Xhr upload I had to use Nginx to solve the cross domain issues as the both servers are on the same machine. But using Nginx has a lot of issues so my boss asked if I can do the same thing using a Cross Domain Policy. I've made it but that is some things that I'm not being able to do. Here is my code: var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(e) {}; xhr.open('POST', self.basePath + '/upload' + file.name, true, null, null, null, true, true); xhr.setRequestHeader("Accept", "application/json, text/javascript, */*; q=0.01"); xhr.setRequestHeader("Connection", "close"); xhr.sendAsBinary(file.getAsBinary()); This works on a Cross Domain Request reaching the Server with the file and returning the response, but when I try to set a progress event like these: var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(e) {}; xhr.upload.onprogress = function(){console.info('on progress');}; xhr.open('POST', self.basePath + '/upload' + file.name, true, null, null, null, true, true); xhr.setRequestHeader("Accept", "application/json, text/javascript, */*; q=0.01"); xhr.setRequestHeader("Connection", "close"); xhr.sendAsBinary(file.getAsBinary()); The Cross Domain Request isn't fired ( the request uses a "OPTIONS" method instead of POST and it never reaches the server ). But, as you may think, I need the progress event to show it to the user. Does anyone knows what is happening?? Ps: All of the codes above works perfectly on a "same domain" request. Ps2: I've tried xhr.onprogress but it is never fired ( on cross or same domain requests ) Ps3: I've tried on FF4+ and Chrome 12+ Thanks A LOT. Thiago JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I faced a similar problem before. Solution: Add * in your CORS configuration on s3

Related questions

0 votes
    AJAX requests can support data transfer in ______ format 1. None of the options 2. JSON 3. XML 4. Any...
asked Feb 26, 2021 in Technology by JackTerrance
0 votes
    What is the vulnerability of XHR communications? (a) There is no vulnerability (b) Skewing the results (c ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    I want to automate the launch of a set of Linux EC2 instances. Basically, I want to write a script/program that ... in Amazon AWS/EC2? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    How should I handle /_ah/start and /_ah/stop requests? Right now they're just getting 404s. Also, ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    A __________ is a program running on the server machine, which accepts requests from a Web ... Fundamentals in division Database Programming Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    When a transaction Ti attempts to update a data item, it requests a _________ on that data item. ... Snapshot Isolation topic in chapter Concurrency Control of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Kafka cluster can enforce quota on requests to control the broker resources used by clients. (1)False (2)True...
asked Jun 16, 2021 in Technology by JackTerrance
0 votes
    The ___________________ is a standard for exchanging authentication and authorization information between different ... Database Programming Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Which of the following are threats of cross site scripting on the authentication page? (1)Session hijacking attacks (2)Phishing (3)All of these (4)Identity theft...
asked May 13, 2021 in Technology by JackTerrance
0 votes
    Two trains 140 m and 160 m long run at the speed of 60 km/hr and 40 km/hr respectively in opposite directions on parallel tracks. The time ... sec B. 9.5 sec C. 7.4 sec D. 8.9 sec...
asked Feb 19, 2021 in Education by JackTerrance
0 votes
    What is the best way to pass the model variables to layout in Grails? Specifically, I'm using Spring ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    Based on the image below, choose the correct domain or domains of AI required for it: a) Data b) NLP c) Computer ... Both (a) and (b) Select the correct answer from above options...
asked Nov 12, 2021 in Education by JackTerrance
...