Skip to content

Angular new browser-esbuild different behaviour with baseHref #26618

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

Closed
mpontreau opened this issue Dec 8, 2023 · 1 comment · Fixed by #26619
Closed

Angular new browser-esbuild different behaviour with baseHref #26618

mpontreau opened this issue Dec 8, 2023 · 1 comment · Fixed by #26619

Comments

@mpontreau
Copy link

mpontreau commented Dec 8, 2023

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

Hello,

As the Vite and Esbuild are out of the developer preview, I tried to use it for my company projects.
It works well except that for each of our apps we had a specific behaviour that we didn't notice before using Vite.

All our app are using a baseHref like this:
"baseHref": "/myapp/"

But all links to our apps are like this:
http://mydomain.com/myapp

What's happening without Vite and EsBuild is that the trailing "/" was automatically added (don't know by who exactly), and by using Vite and Esbuild, it's not added automatically anymore we are getting an error page:

The server is configured with a public base URL of /myapp/ - did you mean to visit /myapp/ instead?

Did you know about this behaviour (didn't find any issue about it) ?
Do you plan to fix it or are you considering that it is now a standard behaviour ?
Thanks for your answer !

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

The server is configured with a public base URL of /myapp/ - did you mean to visit [/myapp/](http://mydomain:9999/myapp/) instead?

Please provide the environment you discovered this bug in (run ng version)

Angular/cli 17.0.5
Node v18.13.0

Anything else?

No response

@JoostK JoostK transferred this issue from angular/angular Dec 8, 2023
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Dec 8, 2023
…uses server not to be accessible without trailing slash

This commit fixes an issue were when using a `baseHref` with trailing slash, vite dev-server would have been only accessible via a URL with a trailing slash. As vite would redirect to an error page similar to the below;

```
The server is configured with a public base URL of /myapp/ - did you mean to visit [/myapp/](http://localhost:4200/myapp/) instead?
```

Closes: angular#26618
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Dec 8, 2023
…uses server not to be accessible without trailing slash

This commit fixes an issue were when using a `baseHref` with trailing slash, vite dev-server would have been only accessible via a URL with a trailing slash. As vite would redirect to an error page similar to the below;

```
The server is configured with a public base URL of /myapp/ - did you mean to visit [/myapp/](http://localhost:4200/myapp/) instead?
```

Closes: angular#26618
clydin pushed a commit that referenced this issue Dec 8, 2023
…uses server not to be accessible without trailing slash

This commit fixes an issue were when using a `baseHref` with trailing slash, vite dev-server would have been only accessible via a URL with a trailing slash. As vite would redirect to an error page similar to the below;

```
The server is configured with a public base URL of /myapp/ - did you mean to visit [/myapp/](http://localhost:4200/myapp/) instead?
```

Closes: #26618
clydin pushed a commit that referenced this issue Dec 8, 2023
…uses server not to be accessible without trailing slash

This commit fixes an issue were when using a `baseHref` with trailing slash, vite dev-server would have been only accessible via a URL with a trailing slash. As vite would redirect to an error page similar to the below;

```
The server is configured with a public base URL of /myapp/ - did you mean to visit [/myapp/](http://localhost:4200/myapp/) instead?
```

Closes: #26618
(cherry picked from commit 4b3a965)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants