Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable directory listings on development server #3916

Merged
merged 1 commit into from
Apr 17, 2015

Conversation

joliss
Copy link
Contributor

@joliss joliss commented Apr 17, 2015

@rwjblue, you mentioned that you want this...

My only worry would be that anybody trying to have an /assets route in their Ember app might have a bad surprise when they deploy to production, depending on how their server or CDN is set up, and now that autoIndex is false we're not catching that in development anymore. But I'm unsure.

if (!fs.existsSync(path.join(results.directory, assetPath))) {
var isFile = false;
try { isFile = fs.statSync(path.join(results.directory, assetPath)).isFile(); } catch (err) { }
if (!isFile) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broccoli's middleware just calls next() instead of serving 404. So if possible, it might be nicer to rearrange the middleware stack so this check becomes unnecessary. I just didn't want to try doing this right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need Broccoli to call next() on non-GET (or some other requests like that) to make that possible, I'm happy to merge a PR.

@rwjblue
Copy link
Member

rwjblue commented Apr 17, 2015

👍

@abuiles
Copy link
Member

abuiles commented Apr 17, 2015

@joliss I just tried this and it works great, thanks!

abuiles added a commit that referenced this pull request Apr 17, 2015
Disable directory listings on development server
@abuiles abuiles merged commit 3108960 into ember-cli:master Apr 17, 2015
@abuiles
Copy link
Member

abuiles commented Apr 17, 2015

@joliss thanks!

@joliss joliss deleted the autoindex branch August 24, 2015 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants