Error Forbidden At Sendstream.error
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Node express routing sendfile fails depending on file location up vote 1 down vote favorite I have a directory structure for a restful express service + Backbone client with pushState enabled like this (client code in public/) app.js lib/routes.js -- public/ -- index.html I set up /public to be a static directory in app.configure: app.use(express.static(__dirname + '/public')); This already works off the bat if the index is visited first. Then when I directly visit a route other than homepage I ensure to redirect to the index.html. This works perfectly fine in app.js, but if I try and put this in lib/routes.js I get a Forbidden error: From app.js works fine: app.get('*', function(req, res) { res.sendfile(__dirname + '/public/index.html'); }); From lib/routes.js: res.sendfile(__dirname + '../public/index.html'); Gives me: Error: Forbidden at SendStream.error (/Users/*****/Sites/myproject/node_modules/express/node_modules/send/lib/send.js:145:16) at SendStream.pipe (/Users/*****/Sites/myproject/node_modules/express/node_modules/send/lib/send.js:307:39) at ServerResponse.res.sendfile (/Users/*****/Sites/myproject/node_modules/express/lib/response.js:345:8) at /Users/*****/Sites/myproject/lib/routes.js:8:7 at callbacks (/Users/*****/Sites/myproject/node_modules/express/lib/router/index.js:164:37) at param (/Users/*****/Sites/myproject/node_modules/express/lib/router/index.js:138:11) at pass (/Users/*****/Sites/myproject/node_modules/express/lib/router/index.js:145:5) at Router._dispatch (/Users/*****/Sites/myproject/node_modules/express/lib/router/index.js:173:5) at Object.router (/Users/*****/Sites/myproject/node_modules/express/lib/router/index.js:33:10) at next (/U
Sign in Pricing Blog Support Search GitHub This repository Watch 1,551 Star 27,801 Fork 5,142 expressjs/express Code Issues 89 Pull requests 37 Projects 0 Wiki Pulse Graphs New issue res.Sendfile returns forbidden on files with ".." in their name #1621 Closed zumoshi opened this Issue May 11, 2013 · 2 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 2 participants zumoshi commented http://stackoverflow.com/questions/22900510/node-express-routing-sendfile-fails-depending-on-file-location May 11, 2013 the relative path; the "../" is considered malicious by res.sendfile() but it doesn't check for ../ or /.. , it only checks for ".." so if i do res.sendfile('/a..txt') it throws Error: Forbidden at SendStream.error (C:\w\node_modules\express\node_modules\send\lib\send.js:145:16) at SendStream.pipe (C:\w\node_modules\express\node_modules\send\lib\send.js:307:39) at ServerResponse.res.sendfile (C:\w\node_modules\express\lib\response.js:339:8) ... at callbacks (C:\w\node_modules\express\lib\router\index.js:161:37) at param (C:\w\node_modules\express\lib\router\index.js:135:11) i https://github.com/expressjs/express/issues/1621 am currently using express send file in a production server to serve user files and some files have 2 dots in their name expressjs member tj commented May 11, 2013 haha yikes silly users, ok we should patch this in https://github.com/visionmedia/send tj closed this May 11, 2013 zumoshi commented May 22, 2013 so did you patched it ? or should i change the source on my server myself ? benkaiser referenced this issue in pillarjs/send Apr 22, 2014 Closed res.Sendfile returns forbidden on files with ".." in their name #39 Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment Contact GitHub API Training Shop Blog About © 2016 GitHub, Inc. Terms Privacy Security Status Help You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Sign in Pricing Blog Support Search GitHub https://github.com/EtienneLem/skeleton/issues/1 This repository Watch 15 Star 229 Fork 14 EtienneLem/skeleton https://github.com/expressjs/express/issues/1708 Code Issues 1 Pull requests 0 Projects 0 Pulse Graphs New issue 403 Forbidden error when creating a new project #1 Closed lsdafjklsd opened this Issue Jul 13, 2012 · 10 comments Projects None yet error forbidden Labels None yet Milestone No milestone Assignees No one assigned 4 participants lsdafjklsd commented Jul 13, 2012 I am sure this is specific to me, but here is the 403 error I am getting with specifics: Express 403 Error: Forbidden error forbidden at at SendStream.error (/Users/ryan/Sites/go2/node_modules/express/node_modules/send/lib/send.js:142:16) at SendStream.pipe (/Users/ryan/Sites/go2/node_modules/express/node_modules/send/lib/send.js:307:52) at Object.static as handle at next (/Users/ryan/Sites/go2/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.expressInit as handle at next (/Users/ryan/Sites/go2/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.query as handle at next (/Users/ryan/Sites/go2/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Function.handle (/Users/ryan/Sites/go2/node_modules/express/node_modules/connect/lib/proto.js:198:3) at Server.app (/Users/ryan/Sites/go2/node_modules/express/node_modules/connect/lib/connect.js:66:31) I have express 3 installed globally, on mac osx lion. Any help appreciated. Owner EtienneLem commented Jul 13, 2012 hmm, have you installed all the dependencies via npm install when in your generated project folder? Does this error happen when visiting http://localhost:3000 or in the generating process? lsdafjklsd commented Jul 13, 2012 Yes, all dependencies are installed, and the error only happens when visiting http://localhost:3000 Owner EtienneLem commented Jul 13, 2012 That is weird. Is it a an Express recurrent problem? What happens if you express myapp && cd myapp && node app.js ? lsdafjklsd commente
Sign in Pricing Blog Support Search GitHub This repository Watch 1,551 Star 27,801 Fork 5,142 expressjs/express Code Issues 89 Pull requests 37 Projects 0 Wiki Pulse Graphs New issue express.static() dumps stacktraces for 403 forbidden even when showstack and dumpexceptions are false #1708 Closed fluff opened this Issue Aug 2, 2013 · 3 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 2 participants fluff commented Aug 2, 2013 This example program (using express 3.3.4) dumps a full stack trace to the HTTP client, exposing full path names and so on, when the client sends a GET for a static path containing "..": var express = require('express'); var app = express(); app.use(express.errorHandler({dumpExceptions: false, showStack: false})); app.use('/public', express.static(__dirname + '/public')); app.listen(3000); Request: % curl http://localhost:3000/public/../ Error: Forbidden at SendStream.error (/private/tmp/express-test/node_modules/express/node_modules/send/lib/send.js:145:16) at SendStream.pipe (/private/tmp/express-test/node_modules/express/node_modules/send/lib/send.js:310:52) at Object.staticMiddleware [as handle] (/private/tmp/express-test/node_modules/express/node_modules/connect/lib/middleware/static.js:84:8) at next (/private/tmp/express-test/node_modules/express/node_modules/connect/lib/proto.js:190:15) at next (/private/tmp/express-test/node_modules/express/node_modules/connect/lib/proto.js:192:9) at Object.expressInit [as handle] (/private/tmp/express-test/node_modules/express/lib/middleware.js:30:5) at next (/private/tmp/express-test/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.query [as handle] (/private/tmp/express-test/node_modules/express/node_modules/connect/lib/middleware/query.js:44:5) at next (/private/tmp/express-test/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Function.app.handle (/private/tmp/express-test/node_modules/express/node_modules/connect/lib/proto.js:198:3) expressjs member tj commented Aug 2, 2013 errorHandler is a dev-only middleware now, not u