Actions
Bug #3265
openIncorrect deployPath detection when url contains cyrillic symbols under nginx
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
06/05/2014
Due date:
% Done:
0%
Estimated time:
Description
I'm trying to load an url which contains cyrillic symbols:
http://127.0.0.1/wt/app.wt/тест
If I deploy my app as Wt web-server or under Apache it works fine. But when I deploy it under nginx, my app gets incorrect deployPath and all my static resources (images, css files) do not load.
I've made some research and found this piece of code in Boot.js:
var pathInfo = _$_PATH_INFO_$_,
deployPath = win.location.pathname;
if (!win.opera)
deployPath = decodeURIComponent(deployPath);
/*
* Java's weird session encoding could put the path not in the end, e.g.
* /hello/internalpath;jsessionid=xyz
*/
if (pathInfo.length > 0) {
var pathI = deployPath.lastIndexOf(pathInfo);
if (pathI != -1)
deployPath = deployPath.substr(0, pathI)
+ deployPath.substr(pathI + pathInfo.length);
}
var deployPathInfo = '&deployPath=' + encodeURIComponent(deployPath);
Here it tries to cut pathInfo
substring from deployPath
.
The problem is that under nginx pathInfo
comes in percent encoding and in this case it is not a substring of deployPath
which was decoded using decodeURIComponent
.
What I get under nginx:
pathInfo= /%d1%82%d0%b5%d1%81%d1%82
deployPath= /wt/app.wt/%D1%82%D0%B5%D1%81%D1%82
deployPath = decodeURIComponent(deployPath);// decoded deployPath= /wt/app.wt/тест
var pathI = deployPath.lastIndexOf(pathInfo);
if (pathI != -1) // FALSE
And under Apache:
pathInfo= /тест
deployPath= /wt/app.wt/%D1%82%D0%B5%D1%81%D1%82
deployPath = decodeURIComponent(deployPath);// decoded deployPath= /wt/app.wt/тест
var pathI = deployPath.lastIndexOf(pathInfo);
if (pathI != -1) // TRUE
I think that if you decode deployPath
, you should also decode pathInfo
No data to display
Actions