angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

404 not found when accessing application sub-link directly with AoT.

Open scandinave opened this issue 9 years ago • 4 comments

OS?

Debian 8 and MacOS Sierra

Versions.

angular-cli: 1.0.0-beta.21 node: 6.7.0 os: darwin x64

Repro steps.

Just makes

ng build --aot

. Compile is success and application can be used. But if i load application from a link that is not the base path, i get a 404 error. The same link access via a buttons in the app, works fine.

So : 1 - http://localhost:4200 : Works 2 - http://localhost:4200 -> click -> http://localhost:4200/foo : Works 3 - http://localhost:4200/foo -> Doesn't work

In case 2, the angular router makes a request to the server : http://localhost:8080/api/foo In case 3, the router seems to not handle anything. So the request is made to http://localhost:4200/foo. There is no server to response to this request and 404 happen.

The log given by the failure.

There is no log. Everything is good for Angular-cli

scandinave avatar Dec 04 '16 20:12 scandinave

I've seen that. so far I am chalking it up to a hickup in routing.

Taco-Gestapo avatar Dec 04 '16 23:12 Taco-Gestapo

Do you have more information? I need to deploy the application to production in 1 month.

scandinave avatar Dec 05 '16 08:12 scandinave

I have found the solution. I have used lr-http-server to display the application. It seems to be not fully compatible with Angular. After switching to lite-server. All works fine.

scandinave avatar Dec 05 '16 12:12 scandinave

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.