Cross-origin resource sharing (CORS) does not work in Firefox 13.0.1 or 6.0.2

I have a simple Java HttpServlet and a simple JSP page. They are both served by a WebSphere Application Server at port 80 on my local host. I have created a TCP/IP Monitor at port 8081 in
Eclipse IDE so as to create a second origin. The protocol output further down comes from this monitor. This should work equally well on a simple Tomcat server.
When I perform the cross-origin resource sharing test, I see that all of the correct TCP data is exchanged between Firefox and the web server (i.e. HTTP OPTIONS and its response followed by an HTTP POST and its response) but the data in the body of the POST response is never passed to the XMLHttpRequest javascript object's responseText or responseXML variables and I get a status equal to 0. If I click the button while pressing the keyboard control key then the test will work as it will not be performed as a cross-origin request.
Here are all of the files used in this test:
Servlet Cors.java
<pre><nowiki>--------------------------------------------------------------------------------------
package example.cors;
import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
* Servlet implementation class Cors
public class Cors extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String APPLICATION_XML_VALUE = "application/xml";
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response); // do the same as on the post
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setBufferSize(1024);
response.setContentType(APPLICATION_XML_VALUE);
response.setStatus(HttpServletResponse.SC_OK);
String xml="<?xml version=\"1.0\"?>\n<hello>This is a wrapped message</hello>";
response.setContentLength(xml.length());
response.getWriter().append(xml);
response.getWriter().close();
* @see HttpServlet#doOptions(HttpServletRequest, HttpServletResponse)
@SuppressWarnings("unchecked")
protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Enumeration<String> headers=request.getHeaders("Origin");
StringBuffer sb=new StringBuffer();
while (headers.hasMoreElements()) {
String o=headers.nextElement();
if (sb.length()!=0) sb.append(", ");
System.err.println("Origin= "+o);
sb.append(o);
response.addHeader("Access-Control-Allow-Origin", sb.toString());
response.addHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS");
sb=new StringBuffer();
headers=request.getHeaders("Access-Control-Request-Headers");
while (headers.hasMoreElements()) {
String o=headers.nextElement();
if (sb.length()!=0) sb.append(", ");
System.err.println("Access-Control-Request-Headers= "+o);
sb.append(o);
response.addHeader("Access-Control-Allow-Headers", sb.toString().toUpperCase());
response.addHeader("Access-Control-Max-Age", Integer.toString(60*60)); // 1 hour
response.addHeader("Content-Type","text/plain");
response.addHeader("Allow", "GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS");
response.getWriter().print("");
And a simple JSP page test.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
String url ="http://localhost:8081/cors/ping";
String url_ctrl="http://localhost/cors/ping";
%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test CORS</title>
<script type="text/javascript">
var invocation;
var method='POST';
var body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><hello>Today</hello>";
var buttontest2_label="Direct AJAX call";
function callOtherDomain(event){
invocation = new XMLHttpRequest();
if(invocation) {
var resultNode = document.getElementById("buttonResultNode");
var resultMessage = document.getElementById("buttonMessageNode");
resultNode.innerHTML = "";
document.getElementById("buttontest2").value="Waiting response...";
var url
if (event.ctrlKey) url="<%=url_ctrl%>";
else url="<%=url%>";
resultMessage.innerHTML = "Sending "+method+" to URL: "+url;
invocation.open(method, url, true);
// invocation.withCredentials = "true";
invocation.setRequestHeader('X-PINGOTHER', 'pingpong');
invocation.setRequestHeader('Content-Type', 'application/xml');
invocation.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
invocation.onerror = function(errorObject) {
display_progress(resultMessage, "***** error occured=" +errorObject);
invocation.onreadystatechange = function() {
display_progress(resultMessage, "onreadystatechange="+invocation.readyState+", status="+invocation.status+", statusText="+invocation.statusText);
if(invocation.readyState == 4){
document.getElementById("buttontest2").value=buttontest2_label;
display_progress(resultMessage, "responseText="+invocation.responseText);
resultNode.innerHTML = "Response from web service='"+invocation.responseText+"'";
invocation.send(body);
function display_progress(node, message) {
node.innerHTML = node.innerHTML + "<br>" + message;
</script>
</head>
<body>
<p>The button will create a cross site request (Use the control key to disable this, i.e. no cross site request)</p>
<p><input type="button" id="buttontest2" onclick="callOtherDomain(event)" name="buttontest2" value="Waiting for page load..."></p>
<p id="buttonMessageNode"></p>
<p id="buttonResultNode"></p>
<script type="text/javascript">
document.getElementById("buttontest2").value=buttontest2_label;
</script>
</body>
</html>
When I click on the Direct AJAX call button, I get the following output on my page:
The button will create a cross site request (Use the control key to disable this, i.e. no cross site request)
Sending POST to URL: http://localhost:8081/cors/ping
onreadystatechange=2, status=0, statusText=
onreadystatechange=4, status=0, statusText=
responseText=
***** error occured=[object ProgressEvent]
Response from web service=''
Here is the HTTP traffic produced:
HTTP REQUEST
OPTIONS /cors/ping HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Origin: http://localhost
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type,x-pingother,x-requested-with
Pragma: no-cache
Cache-Control: no-cache
POST /cors/ping HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
X-PINGOTHER: pingpong
Content-Type: application/xml; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://localhost/cors/client/test.jsp
Content-Length: 75
Origin: http://localhost
Pragma: no-cache
Cache-Control: no-cache
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><hello>Today</hello>
HTTP RESPONSE
HTTP/1.1 200 OK
Access-Control-Allow-Origin: http://localhost
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: CONTENT-TYPE,X-PINGOTHER,X-REQUESTED-WITH
Access-Control-Max-Age: 3600
Content-Type: text/plain;charset=ISO-8859-1
Allow: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS
Content-Language: en-CA
Content-Length: 0
Date: Wed, 11 Jul 2012 17:50:10 GMT
Server: WebSphere Application Server/7.0
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 62
Content-Language: en-CA
Date: Wed, 11 Jul 2012 17:50:10 GMT
Server: WebSphere Application Server/7.0
<?xml version="1.0"?>
<hello>This is a wrapped message</hello>
--------------------------------------------------------------------------------------</nowiki></pre>

No errors in error console. No effect using *. I tried using the dns name of my localhost both in the Firefox URL and in the javascript and I get exactly the same. I have spent a huge amount of time looking into this issue.
One thing I noticed is that if I use the examples on the internet (http://arunranga.com/examples/access-control/preflightInvocation.html or http://saltybeagle.com/cors/) they work in the same browser. These examples however, are accessed through HTTP proxies.
I am wondering if the issue has to do with using the same hostname just with different ports.

Similar Messages

  • Thickbox 3.1 juqery plugin does not working on Firefox 9.0 version

    I have used thickbox 3.1 jquery plugin on my application. I have one issue, my open on new browser window instead on thickbox window. It's working fine with all the browser and with Firefox 3.6.0. But It does not working with firefox higher version like 9.0 and above. I have gone through the various forum to check the solution and being unlucky to found any.
    Can you plese help to identifying the solution for the same.

    Thanks for your quick comeback. What I found is the bug is in my js file which has fire event function to init click MouseEvents (event.initEvent). The event.initEvent has some conflicts with higher version of Firefox 9.0 and above.
    // evObj.initEvent( evt, true, false); if I change parameter to evObj.initEvent( evt, true, true); it works fine. the last parameter.
    //see below my piece of code.
    // Emulate a click on a given link
    function fireEvent(obj,evt) {
    var fireOnThis = obj;
    if( document.createEvent ) {
    var evObj = document.createEvent('MouseEvents');
    evObj.initEvent( evt, true, true );
    fireOnThis.dispatchEvent(evObj);
    } else if( document.createEventObject ) {
    fireOnThis.fireEvent('on'+evt);
    }

  • Adobe AIR 2.0.3 Installer does not work in Firefox 3.6.8 (win7/osx leopard) via badge installer

    Using the Air installer feature of the Air App Badge installer from http://www.adobe.com/devnet/air/articles/air_badge_install.html
    does not work in Firefox 3.6.8 on both windows 7 and osx leopard 10.5.8.
    seems to be still functional in firefox windows xp and osx snow leopard 10.6.3
    To reproduce. without having air installed on your windows7 or osx leopard machine, go to http://www.tweetdeck.com/desktop/ and click on the "Download" button to begin air install. the "Yes" and "No" buttons are unresponsive. Air will fail to install.

    There is a thread on the topic on the Photoshop forum: http://forums.adobe.com/message/4124703#4124703
    Strange, it works in CS4
    But you guys are able to go to http://help.adobe.com/en_US/photoshop/cs/using/index.html right?
    It might be useful to know that you can set Community Help Sites as a search engine in your browser (it should offer you to register itself as a search engine, while Safari users have to add Glims to add additional search engines.) http://blogs.adobe.com/communityhelp/2009/01/opensearch_plugins_available_f.html

  • URL Does Not Work in Firefox, but DOES Work in Other Browsers

    The following URL does NOT work in Firefox. However, it DOES work in Internet Explorer and Google Chrome:
    https://www.ascap.com/ace/
    The main ASCAP URL works just fine. The problem seems to be confined to this link alone. Please fix; thank you!

    There is a server redirect on this URL.
    <pre><nowiki>
    https://www.ascap.com/ace/
    GET /ace/ HTTP/1.1
    Host: www.ascap.com
    HTTP/1.1 302 Found
    Location: https://www.ascap.com/Home/ace-title-search/index.aspx</nowiki></pre>
    If you use a bookmark then try to navigate to the want page starting with the main (home) page.
    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"

  • The attach a file button (in netzero e-mail) does not work in firefox but does in explorer

    The "attach file button" (in net zero e-mail) does not work in firefox but does in explorer.
    == URL of affected sites ==
    http://

    *Tools > Options > Privacy > History: Firefox will: "Use custom settings for history"
    *Tools > Options > Privacy > History: "Remember search and form history"
    See also [[Form autocomplete]]

  • The "a name" html tag does not work in Firefox.

    The tag works in all versions of Internet Explorer, but does not work in Firefox versions 3, 4, 5, 10, 11, 12.

    I haven't noticed any problems on most pages, but I have read about a problem where a script changes the length of the page content after loading (e.g., by collapsing content under headings, done on some FAQ or glossary pages).
    For example, this should position the browser at the Reset Printer section:
    http://kb.mozillazine.org/Problems_printing_web_pages#Reset_printer
    A standard diagnostic step is to try Firefox's Safe Mode to see whether an odd behavior is caused by a custom setting or add-on.
    First, I recommend backing up your Firefox settings in case something goes wrong. See [[Backing up your information]]. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.)
    Next, restart Firefox in [[Safe Mode]] using
    Help > Restart with Add-ons Disabled
    In the Safe Mode dialog, do not check any boxes, just click "Continue in Safe Mode."
    If links work correctly in Safe Mode, that usually points to an add-on or custom setting as the problem.
    Let us know whether that makes any difference.

  • Silverlight plug-in does not works in FireFox 4 - beta 7 ( Mac OS 10.6.6 ) !!!! What is the problem ? I don't have any installed add-on !!!

    Hi every one
    Silverlight plug-in does not works in FireFox 4 - beta 7 ( Mac OS 10.6.6 ) !!!!
    I don't have any installed Extensions except "Better GReader" and "Video Helper" !!!
    I have problem with Seesmic.com and installing applications that required Silverlight !
    I installed latest version of Silverlight many times.
    Please help me.
    (I don't have any problem with Safari or other Web Browser.)
    Thank You all.

    Silverlight only supports non-64 bit versions of Firefox on OSX (and from Firefox 4 onwards we're shipping 64-bit Firefox to 64-bit OSX users) and unlike with other plugins, we can't just start a 32-bit process to run it because of issues with the silverlight plugin architecture. We're working with the Silverlight team at Microsoft to get those fixed but it's essentially waiting on them.
    (Or you could try to pressure them into releasing a 64-bit Silverlight for Macs.)

  • Paypal plug-in does not work on Firefox

    As with others I see, the Paypal plug-in does not work with Firefox
    == This happened ==
    Every time Firefox opened
    == When I downloaded the app

    This is a Paypal problem. Paypal has not updated their plugin to be compatible with Firefox 3.6.x. See the following (read the last paragraph):
    [https://www.paypal.com/helpcenter/panels/solution/printSolution.jsp;jsessionid=tSQcMKWGhpC1gF5TscjTvqGgR89SSQy40mWymRYM12RX2PVG6rTL!1610223101?t=solutionTab&ft=browseTab&locale=en_US&brand=&segment=&ps=solutionPanels&solutionId=39780&highlightInfo=highlightInfo&viewMode=NORMAL&windowType=SAME&isRecord=false&highlightInfo=highlightInfo&t=solutionTab&ft=browseTab&ps=solutionPanels&locale=en_US&_dyncharset=UTF-8&countrycode=US&cmd=_help&serverInstance=9024&viewMode=NORMAL&windowType=SAME&highlightInfo=&isRecord=false&no_strip= What is the PayPal Plug-In and how does it work?]
    I have seen some users posting that the plugin works with Firefox 3.5.x

  • -moz-transform:scale does not work in Firefox with select tag(DropDown)

    -moz-transform:scale does not work in Firefox with select tag(Dropdown). The Dropdown options are being displayed at incorrect location.

    'Hi, Please try the HTML attached in image. This works in IE, Safari, Crome but not in Firefox

  • 1-click weather extension does not work in Firefox 4...

    The 1-Click Weather extension does not work in Firefox 4. It comes up with a bunch of Javascript errors.

    You'll need a little bit of tweaking on this add-on. Please read this link. It might take a little bit of work, but it does worth it as 1-Click Weather is a far better add-on than any others of the same category:
    https://addons.mozilla.org/en-US/firefox/user/5661757/

  • Shared variable does not work between two computers

    I am using LabVIEW 8 on Windows XP computers.
    1. On one computer I have created two projects, writeProject and readProject.
    2.  In the writeProject I have a shared variable, writeData, which is "network-published" double. In this project I have a writeData.vi which in while loop assigns a random value to the writeData variable.
    3. In the readProject I have a shared variable, readData, which is "network-published" double and is bound to the writeData variable.  This is on the same computer as the writeProject.
    4. I run both the writeData.vi and the readData.vi and all works fine.
    5. Now, I create a readProject on a diferent computer.  Perform all the steps as described above and also in tools/shared variable/register computer, I have entered the IP address of the target computer on which the writeData shared variable exists.
    6. Binding the readData variable fails in the following way.  When I browse for the source, in the "Select Source Item" dialog, I see <IP> <Populating Node...>, where <IP> is the IP address of the source computer (on which exists the writeData shared variable).  A very long time later it is still "Populating Node...".  Neddless to say, this readData.vi does not work!
    What am I doing wrong?  Or, perhapse what else do I need to do to make it work?

    Hi,
    I would suggest checking out the two KnowledgeBases I have linked below for common issues with Network Shared Variables. Let me know the results. Thanks!
    Troubleshooting Network-Published Shared Variables
    Why Are My Network Shared Variables Taking Very Long to Initialize?
    Stephanie

  • Drag and drop does not work in firefox 3

    Does anybody has the same issue with firefox when you add a layout to the oracle composer and you want to drag and drop some components that it just does not work...
    When i hoover over the title bar of a component i see the cross icon but the drag & drop does not work. WHen i do the same in IE8 or google chrome, it does work.
    I have this issue for both oracle composer stuff as for sites i build in webcenter spaces.
    We are working with the latest version of webcenter

    WebCenter is compatible with:
    * Firefox 2 & 3
    * Internet Exploirer 7 and 8
    * Safari 3.0
    It might be caused by a firefox extension in your browser.

  • Adobe flash player does not work on Firefox, but does on Wind Exp

    I have reinstalled Adobe Flash Player many times and also reinstalled Firefox, but flash player does not work. Every tim I try to play something it tells me to install the latest version of flash player. Flash player works fine on on Windows Explorer

    IE uses a different version of Flash (ActiveX) than other browsers use, you need to install the Plugin version of Flash.
    1.Download the Flash setup file from here: <br />
    [http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe Adobe Flash - Plugin version]. <br />
    Save it to your Desktop.<br />
    2. Close Firefox using File > Exit <br />
    then check the Task Manager > Processes tab to make sure '''firefox.exe''' is closed, <br />
    {XP: Ctrl+Alt+Del = Processes tab}
    3. Then run the Flash setup file from your Desktop.

  • Macbook Pro Pinch/Zoom feature does not work with Firefox 6

    Can someone please tell me how to fix this major problem?
    I can not get the Pinch/Zoom feature on the track pad to work on my Macbook Pro. I am running OS 10.6.8.
    I have seen this below in other posts, and have tried it, but it STILL does not work !!!!
    '''''Some gestures have been removed in Firefox 4.
    '''You can restore the zoom feature by changing the values of the related prefs on the about:config page.
    '''browser.gesture.pinch.in -> cmd_fullZoomReduce<br>
    '''browser.gesture.pinch.in.shift -> cmd_fullZoomReset<br>'''
    '''browser.gesture.pinch.out -> cmd_fullZoomEnlarge<br>'''
    '''browser.gesture.pinch.out.shift -> cmd_fullZoomReset<br>''''''
    '''To open the about:config page, type about:config in the location (address) bar and press the "Enter" key, just like you type the url of a website to open a website.'''
    '''If you see a warning then you can confirm that you want to access that page.'''''''''''
    Please someone help me - this is a great feature and its really pissing me off that I can't use it.
    HELP !!!

    I'VE TRIED THIS:
    browser.gesture.pinch.in -> cmd_fullZoomReduce
    browser.gesture.pinch.in.shift -> cmd_fullZoomReset
    browser.gesture.pinch.out -> cmd_fullZoomEnlarge
    browser.gesture.pinch.out.shift -> cmd_fullZoomReset
    browser.gesture.pinch.latched -> false
    I'VE TRIED ALL OF THE ABOVE NUMEROUS TIMES AND IT DOES NOT WORK ON MACBOOK PRO AND FIREFOX 6.
    CAN ANYBODY HELP? THANKS ♥

  • Flash does not work with Firefox following Windows Vista update 14/5/2014.

    Flash still works with IE9. I've carried out all steps in http://helpx.adobe.com/flash-player/kb/flash-player-games-video-or.html, i.e. twice updated Flash to V13.0.0.214 (previously V13.0.0.206), activated Firefox Flash add-on, deleted browser data and cache and disabled hardware acceleration. Nothing fixes it! Vista SP2, Firefox 29.0.1.

    Apologies for vague "does not work" from me - and sorry for delay replying. What I understand to be "rich media content" did not display. For example, all text and images in this screen clip from www.metoffice.gov.uk appeared as a single blank grey rectangle. In other websites links displayed in a basic underlined font instead of rich formatted text/images, or video and audio links were completely missing from an otherwise fully rendered webpage.
    However in the last hour Firefox has starting behaving properly again without any further diagnostic efforts from me! For six days some graphics and links have not displayed in Firefox, yet IE9 has behaved perfectly. This has happened a few times before, normal service being restored (in hours rather than days) either by updating the Flash plug-in or for no apparent reason.
    Any thoughts in case of future re-occurrences would be appreciated. Thanks Pat for your time and help.

Maybe you are looking for

  • OSMF NetStream firing end event too early

    HI, I originally posted this here: http://forums.adobe.com/message/5067347#5067347 but I got no responses and then remembered an OSMF specific forum where I hoped I might find more help! I've been digging into a bug report where the ends of adverts a

  • How to check the value of "The Interrupt Status Flag"?

    Hi, thank you for reading this post! Invoking Thread.interrupt() sets the value of the Interrupt Status Flag. Just wondering if there is a Java method to check the value of this flag? Or is using isInterrupted() or interrupted() the only way to check

  • Oracle 9.2.0.8 and AWR report?

    Does anyone know if 9.2.0.8 supports AWR? Thanks in advance!

  • Behaviors tab in Tag Inspector panel

    When assigning behavior effects to page elements, the effects are associated with the onClick event evn if not specified. In many instances the panel dows not display the behavior when assigned. When the event is changed from onClick to any other eve

  • Running a query

    Guys I want to debug the below select statement for each record in the employee table. But in pl/sql I simply cannot run the statement without storing the result.Can some one tell me.Note I am doing this only for debugging sake to found out which rec