mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
@@ -1,5 +1,6 @@
|
||||
## v.NEXT
|
||||
|
||||
* Fix stack trace when a browser tries to use the server like a proxy. #1212
|
||||
|
||||
## v1.0.2.1, 2014-Dec-22
|
||||
|
||||
|
||||
@@ -97,6 +97,10 @@ _.extend(RoutePolicyConstructor.prototype, {
|
||||
self.urlPrefixTypes[urlPrefix] = type;
|
||||
},
|
||||
|
||||
isValidUrl: function (url) {
|
||||
return url.charAt(0) === '/';
|
||||
},
|
||||
|
||||
classify: function (url) {
|
||||
var self = this;
|
||||
if (url.charAt(0) !== '/')
|
||||
|
||||
@@ -565,6 +565,18 @@ var runWebAppServer = function () {
|
||||
var rawConnectHandlers = connect();
|
||||
app.use(rawConnectHandlers);
|
||||
|
||||
// We're not a proxy; reject (without crashing) attempts to treat us like
|
||||
// one. (See #1212.)
|
||||
app.use(function(req, res, next) {
|
||||
if (RoutePolicy.isValidUrl(req.url)) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
res.writeHead(400);
|
||||
res.write("Not a proxy");
|
||||
res.end();
|
||||
});
|
||||
|
||||
// Strip off the path prefix, if it exists.
|
||||
app.use(function (request, response, next) {
|
||||
var pathPrefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
|
||||
|
||||
Reference in New Issue
Block a user