java - GWT Upload on Google Appengine - cross site protection -
i want implement file upload gwt application running on google app engine. used gwtupload, following error if try upload file:
<stdout>: 2015-06-14 17:50:35 error uploadservlet:70 - checkcors error origin: http://myapp.appspot.com not match:^$
i looked uploadservlet , there check on origin againg "^$". not quite regex matches "^" seems start of string , "$" end of it. seems match against empty string?
private boolean checkcors(httpservletrequest request, httpservletresponse response) { string origin = request.getheader("origin"); if (origin != null && origin.matches(corsdomainsregex)) { // maybe user has used domain before , has session-cookie, delete // cookie c = new cookie("jsessionid", ""); // c.setmaxage(0); // response.addcookie(c); // doxx methods should set these header response.addheader("access-control-allow-origin", origin); response.addheader("access-control-allow-credentials", "true"); return true; } else if (origin != null) { logger.error("checkcors error origin: " + origin + " not match:" + corsdomainsregex); } return false; }
i can not set "corsdomainsregex" or override method checkcors() since both private. whats actual problem here? how can solve this?
this hardwired check prevent people uploading files via other domain names. if don't need this, can change corsdomainsregex adding following web.xml (or whatever domain wish check against).
<context-param> <!-- match domains --> <param-name>corsdomainsregex</param-name> <param-value>.*</param-value> </context-param>
Comments
Post a Comment