Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Bad requests for static content should return 404 #286

polidore opened this Issue · 14 comments

8 participants


I understand the idea of returning the main client for any path due to HTML5 client side paths, but if a HTTP request asks for a .html, .png, .jpg, it would be better to return a 404 if there is no such content in the static directory. Today it returns the client for bad urls to static content, and this can yield odd results.

In sum, RESTful path? return the client.
Request for an asset (*.html, *.jpg, *.png, *.gif) that doesn't exist? 404.



I agree. Good point.

If you fancy having a crack at this I'd gladly merge it in; otherwise I'll add it to the TODO list.

Basically we need to change the logic here:

so that we parse the URL request, isolate the extension, and pass every request to the static handler (by calling next()) if it is for a .jpeg, .png, etc.

@polidore polidore referenced this issue in polidore/ss-angular

Templates in sub folders? #18


This still seems to be happening. In my case, the browser keeps on reloading all the Javascripts, finally leading to a crash.

Debugging this kind of behavior is very hard and I nearly abandoned SS because of it. Thanks to @polidore who came up with a solution in the referenced issue above.

@paulbjensen paulbjensen was assigned

I will fix this before 0.3.11 is released.


Ran into an issue adding twitter bootstrap and the css files attempt to load fonts/ as static content and socketstream has a meltdown. I believe this is of a similar issue? I'm willing to dive in and see if I can't sort this out. @paulbjensen do you have existing work on this that I should look at? Or just jump in?


Have you tried to copy the fonts Folder from Bootstrap into the client static folder?


I can also recommend loading Bootstrap via a CDN as a way to work around this issue:

@import url('')
@import url('')

We'll need to take a look at this file:

I'll be at home in an hour to have a look at this.


Actually problem in the original *.css files. I'm using font-awesome and it works just fine. All you need to do is:
1. Move fonts folder into client/static/fonts
2. Move all the *.css file into client/css/
2. Replace all the entries of ../fonts/ in *.css with /fonts/

@font-face {
  font-family: 'FontAwesome';
  src: url('/fonts/fontawesome-webfont.eot?v=4.0.2');
  src: url('/fonts/fontawesome-webfont.eot?v=4.0.2#iefix') format('embedded-opentype'), url('/fonts/fontawesome-webfont.woff?v=4.0.2') format('woff'), url('/fonts/fontawesome-webfont.ttf?v=4.0.2') format('truetype'), url('/fonts/fontawesome-webfont.svg?v=4.0.2#fontawesomeregular') format('svg');
  font-weight: normal;
  font-style: normal;

Thanks @RomanMinkin.

We'll need to find a way to allow SocketStream http routing to be configurable so that HTTP requests for files can return a 404 instead of the html for the client, at the moment 200's are returned, and the parser for that file breaks because it's getting back HTML content where it expects something else.

On a side note, something to consider for 0.4 will be how to support using client-side modules/components in such a way that we could install them via either npm or bower or, and then load them in our app without need to move files to different locations. It's a tough cookie, but I think that cracking this would be great.


+1 for that cookie.


@RomanMinkin thanks for the input, that fixed my problem. looks like I was trying to link my fonts within the css folder, not sure why I didn't try the static directory. thnkx.


This is now fixed by PR #419. It will be part of release 0.3.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.