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

"ng serve" dosn't support --bh parameter #2294

Closed
kpociecha opened this Issue Sep 22, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@kpociecha

kpociecha commented Sep 22, 2016

I can set base href when building "ng build --prod --bh /ui/" but I can't do that when running development server with "ng serve". It would be nice to some way to set it up easily.

@dzonatan

This comment has been minimized.

Contributor

dzonatan commented Sep 26, 2016

Why you need that? Just make it opposite: use default "/" for development and "/ui/" for production.

@kpociecha

This comment has been minimized.

kpociecha commented Sep 26, 2016

I am using "ng serve" for development (base href: "/", and mocked back-end)
and to quickly test it with real back-end and for that i need to have base href set to "/ui/" (all our services are behind proxy).

@filipesilva

This comment has been minimized.

Member

filipesilva commented Oct 5, 2016

ng serve doesn't support base href, and we're not looking at supporting it at the moment.

@filipesilva filipesilva closed this Oct 5, 2016

@angel-vladov

This comment has been minimized.

angel-vladov commented Jan 23, 2017

@kpociecha I managed to run serve with base href using a proxy. It's not perfect but will do the job for the time being.

If the base href I need is project then:

ng serve --proxy-config proxy.conf.json --live-reload-base-url /project/

And in proxy.cong.json:

[
  {
    "context": [
      "/project"
    ],
    "target": {
      "host": "localhost",
      "protocol": "http:",
      "port": 4200
    },
    "secure": false,
    "pathRewrite": {
      "^/project": "/"
    }
  }
]

In index.html (we need to set this manually because --bh won't work with ng serve):
<base href="/editor/">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment