I'm using nx as my monorepo management tool, which contains typescript apis and angular frontends.
Now i'm trying to get my project running inside github codespaces.
Everything works fine except the angular applications, when I try to serve them.
The I get and error Invalid Host/Origin header
.
This issue can be resolved using the --public-host
flag.
This is how I can now server my angular applications using the codespaces environment variable CODESPACE_NAME
and nx cli:
npx nx serve application --publicHost=${CODESPACE_NAME}-4080.githubpreview.dev:443
My question is now, if it's possible to configure a new target inside project.json
to serve my application like npx nx run application:codespaces
?
I already tried to create a new target but it does not resolve the environment variable:
...
"codespaces": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "console:build:production"
},
"development": {
"browserTarget": "console:build:development"
}
},
"defaultConfiguration": "development",
"options": {
"publicHost": "${CODESPACE_NAME}-4080.githubpreview.dev:443",
"port": 4080
}
},
...