Angular-cli: Server returns 404 for paths that contain spaces

Created on 27 Feb 2017  路  12Comments  路  Source: angular/angular-cli

I'm stuck at v1.0.0-beta.31 because with every version after that (including v1.0.0-rc.0), the server returns 404 when making a request to a path that contains spaces, for example: "http://localhost:4200/app/resources/drumkits/acoustik%20GM/Acoustic%20Bass%20Drum.wav"

I'm on macOS v10.12.3 and node v6.9.5.

investigation

All 12 comments

I have just migrated from v1.0.0-beta.31 to v1.0.0-rc.0 and found out that the Live Development Server needs to add "src" into the URL. Instead of "http://localhost:4200/app/..." it should be "http://localhost:4200/src/app/...".
Please revert.

Last working: 1.0.0-beta.31

Broken: 1.0.0-beta.32, rc.0 andrc.1.

Tested: Windows 7 and both Node 6.9 and 7.7.

Not among the known breaking changes.

Looking for a way to revert global install to 1.0.0-beta.31 in order to create new projects where assets work.

@sumitarora @maximedupre The issue title could be changed to "Server returns 404 for all asset paths without src/".

The issue title could be changed to "Server returns 404 for all asset paths without src/".

I'm not sure this accurate, because if I just change the name of my file to contain no spaces, and link to it without "src/", it works.

if I just change the name of my file to contain no spaces, and link to it without "src/", it works.

Perhaps we're seeing two separate issues here. My asset URLs fail without any spaces in 1.0.0-beta.32 through to to 1.0.0-rc.1:

http://localhost:4200/styles.css doesn't work, redirects to server root
http://localhost:4200/src/styles.css works.

Same problem here, resource name with space, error 404. Windows 7, node 7.7.2, npm 4.1.2, @angular/cli: 1.0.0-rc.1

@sumitarora I think you were investigating this issue, or a similar one. Did you find a solution?

Like @Daedalon, I seem to have run into the issue with styles.css. No space in the filename here, but styles.css was returning a 404 when specifying just styles.css as the href in the link tag, in index,html, but prefixing it with src/ resolved the issue.

FWIW, the ToH tutorial router section directs users to add styles.css to index.html using:

<link rel="stylesheet" href="styles.css">

which doesn't appear to work for CLI-generated apps.

At least for the issue this ticket was created for, it is fixed in v1.0.0.

Edit: Nvm...

@maximedupre The issues I experienced with styles.css etc. were resolved in 1.0.

@Daedalon We were having different issues though. Too bad mine wasn't also fixed in 1.0.

Fixed in 1.0.3

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings