Hot reload on second Angular instance is only performed if the first instance is changedwhat's wrong with this configuration for nginx as reverse proxy for node.js?Express - req.ip returns 127.0.0.1Ngnix Jsession changed redirection issuetornado stop response after about 37000 requestsWordpress constant redirect with nginx upstream“Cannot GET /db/read/getall” accessing node.js express API using reverse proxy nginx on digitalocean dropletKeycloak Redirect url with nginx is going to http rather than httpsAngular build produce invalid folder pathnginx docker compose redirect delay
Why must Chinese maps be obfuscated?
"The cow" OR "a cow" OR "cows" in this context
What's the difference between using dependency injection with a container and using a service locator?
My bank got bought out, am I now going to have to start filing tax returns in a different state?
Creating a chemical industry from a medieval tech level without petroleum
A faster way to compute the largest prime factor
Which big number is bigger?
How much cash can I safely carry into the USA and avoid civil forfeiture?
Where was the County of Thurn und Taxis located?
What is the unit of time_lock_delta in LND?
Island of Knights, Knaves and Spies
Philosophical question on logistic regression: why isn't the optimal threshold value trained?
What is the term for a person whose job is to place products on shelves in stores?
How to not starve gigantic beasts
Why is the underscore command _ useful?
Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?
Negative Resistance
What *exactly* is electrical current, voltage, and resistance?
Retract an already submitted recommendation letter (written for an undergrad student)
How to keep bees out of canned beverages?
How do I check if a string is entirely made of the same substring?
Is there a word for the censored part of a video?
Combinatorics problem, right solution?
How much of a wave function must reside inside event horizon for it to be consumed by the black hole?
Hot reload on second Angular instance is only performed if the first instance is changed
what's wrong with this configuration for nginx as reverse proxy for node.js?Express - req.ip returns 127.0.0.1Ngnix Jsession changed redirection issuetornado stop response after about 37000 requestsWordpress constant redirect with nginx upstream“Cannot GET /db/read/getall” accessing node.js express API using reverse proxy nginx on digitalocean dropletKeycloak Redirect url with nginx is going to http rather than httpsAngular build produce invalid folder pathnginx docker compose redirect delay
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
In order to have a production like setup, I want to hide all of the dev server enpoints of Angular and PHP behind an nginx reverse proxy (listening on port 8002).
For the most part this is working.
The API properly delivers its data and processes requests as expected.
The Angular dev servers also deliver their apps as expected.
The only issue I have is in regard to hot reloading of the second Angular dev server instance, as it only reloads on changes in the first instance.
The main angular app which runs on port 4200 works properly with hot reloading.
However, the second instance (running on port 4300) does not listen to the sockjs instance with the location ~ ^/collector/sockjs-node/
but to the location ~ ^/sockjs-node/
.
This surprises me, as the base in my index.html
is set to the correct path: <base href="/collector/">
.
So, I could conclude, that I (probably) have to change some setting in angular in order to get it to notify the app on a different endpoint.
My angular.json
is pretty much the auto generated config from the setup, except that I added the PWA package of angular.
My angular.json
is the following, with the app name replaced by 'some-app' as it is still in development and not published yet:
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects":
"some-app":
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics":
"@schematics/angular:component":
"style": "sass"
,
"architect":
"build":
"builder": "@angular-devkit/build-angular:browser",
"options":
"outputPath": "dist/some-app",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"src/styles.scss"
],
"scripts": [],
"es5BrowserSupport": true
,
"configurations":
"production":
"fileReplacements": [
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
],
"serviceWorker": true,
"ngswConfigPath": "src/ngsw-config.json"
,
"serve":
"builder": "@angular-devkit/build-angular:dev-server",
"options":
"browserTarget": "some-app:build"
,
"configurations":
"production":
"browserTarget": "some-app:build:production"
,
"extract-i18n":
"builder": "@angular-devkit/build-angular:extract-i18n",
"options":
"browserTarget": "some-app:build"
,
"test":
"builder": "@angular-devkit/build-angular:karma",
"options":
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
]
,
"lint":
"builder": "@angular-devkit/build-angular:tslint",
"options":
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
,
"some-app-e2e":
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect":
"e2e":
"builder": "@angular-devkit/build-angular:protractor",
"options":
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "some-app:serve"
,
"configurations":
"production":
"devServerTarget": "some-app:serve:production"
,
"lint":
"builder": "@angular-devkit/build-angular:tslint",
"options":
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
,
"defaultProject": "some-app"
In case, it can also be fixed in nginx, this is my current settings file for the setup, which is included in the http
settings block in /etc/nginx/nginx.conf
:
map $http_upgrade $connection_upgrade
default upgrade;
'' close;
upstream websocket
server 127.0.0.1:4200;
server 127.0.0.1:4300;
server 127.0.0.1:5656;
server
listen 8002;
server_name localhost;
location ~ ^/api(.*)
proxy_pass http://127.0.0.1:8000$1$is_args$args;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/sockjs-node/
proxy_pass http://127.0.0.1:4200;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/collector/sockjs-node/
proxy_pass http://127.0.0.1:4300;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/collector(.*)
proxy_pass http://127.0.0.1:4300$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ^~ /push/
proxy_pass http://127.0.0.1:5656;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~
proxy_pass http://127.0.0.1:4200$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
angular nginx reverse-proxy
add a comment |
In order to have a production like setup, I want to hide all of the dev server enpoints of Angular and PHP behind an nginx reverse proxy (listening on port 8002).
For the most part this is working.
The API properly delivers its data and processes requests as expected.
The Angular dev servers also deliver their apps as expected.
The only issue I have is in regard to hot reloading of the second Angular dev server instance, as it only reloads on changes in the first instance.
The main angular app which runs on port 4200 works properly with hot reloading.
However, the second instance (running on port 4300) does not listen to the sockjs instance with the location ~ ^/collector/sockjs-node/
but to the location ~ ^/sockjs-node/
.
This surprises me, as the base in my index.html
is set to the correct path: <base href="/collector/">
.
So, I could conclude, that I (probably) have to change some setting in angular in order to get it to notify the app on a different endpoint.
My angular.json
is pretty much the auto generated config from the setup, except that I added the PWA package of angular.
My angular.json
is the following, with the app name replaced by 'some-app' as it is still in development and not published yet:
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects":
"some-app":
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics":
"@schematics/angular:component":
"style": "sass"
,
"architect":
"build":
"builder": "@angular-devkit/build-angular:browser",
"options":
"outputPath": "dist/some-app",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"src/styles.scss"
],
"scripts": [],
"es5BrowserSupport": true
,
"configurations":
"production":
"fileReplacements": [
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
],
"serviceWorker": true,
"ngswConfigPath": "src/ngsw-config.json"
,
"serve":
"builder": "@angular-devkit/build-angular:dev-server",
"options":
"browserTarget": "some-app:build"
,
"configurations":
"production":
"browserTarget": "some-app:build:production"
,
"extract-i18n":
"builder": "@angular-devkit/build-angular:extract-i18n",
"options":
"browserTarget": "some-app:build"
,
"test":
"builder": "@angular-devkit/build-angular:karma",
"options":
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
]
,
"lint":
"builder": "@angular-devkit/build-angular:tslint",
"options":
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
,
"some-app-e2e":
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect":
"e2e":
"builder": "@angular-devkit/build-angular:protractor",
"options":
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "some-app:serve"
,
"configurations":
"production":
"devServerTarget": "some-app:serve:production"
,
"lint":
"builder": "@angular-devkit/build-angular:tslint",
"options":
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
,
"defaultProject": "some-app"
In case, it can also be fixed in nginx, this is my current settings file for the setup, which is included in the http
settings block in /etc/nginx/nginx.conf
:
map $http_upgrade $connection_upgrade
default upgrade;
'' close;
upstream websocket
server 127.0.0.1:4200;
server 127.0.0.1:4300;
server 127.0.0.1:5656;
server
listen 8002;
server_name localhost;
location ~ ^/api(.*)
proxy_pass http://127.0.0.1:8000$1$is_args$args;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/sockjs-node/
proxy_pass http://127.0.0.1:4200;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/collector/sockjs-node/
proxy_pass http://127.0.0.1:4300;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/collector(.*)
proxy_pass http://127.0.0.1:4300$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ^~ /push/
proxy_pass http://127.0.0.1:5656;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~
proxy_pass http://127.0.0.1:4200$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
angular nginx reverse-proxy
Can you please add your angular.json file ?
– JFPicard
Mar 22 at 16:45
add a comment |
In order to have a production like setup, I want to hide all of the dev server enpoints of Angular and PHP behind an nginx reverse proxy (listening on port 8002).
For the most part this is working.
The API properly delivers its data and processes requests as expected.
The Angular dev servers also deliver their apps as expected.
The only issue I have is in regard to hot reloading of the second Angular dev server instance, as it only reloads on changes in the first instance.
The main angular app which runs on port 4200 works properly with hot reloading.
However, the second instance (running on port 4300) does not listen to the sockjs instance with the location ~ ^/collector/sockjs-node/
but to the location ~ ^/sockjs-node/
.
This surprises me, as the base in my index.html
is set to the correct path: <base href="/collector/">
.
So, I could conclude, that I (probably) have to change some setting in angular in order to get it to notify the app on a different endpoint.
My angular.json
is pretty much the auto generated config from the setup, except that I added the PWA package of angular.
My angular.json
is the following, with the app name replaced by 'some-app' as it is still in development and not published yet:
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects":
"some-app":
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics":
"@schematics/angular:component":
"style": "sass"
,
"architect":
"build":
"builder": "@angular-devkit/build-angular:browser",
"options":
"outputPath": "dist/some-app",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"src/styles.scss"
],
"scripts": [],
"es5BrowserSupport": true
,
"configurations":
"production":
"fileReplacements": [
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
],
"serviceWorker": true,
"ngswConfigPath": "src/ngsw-config.json"
,
"serve":
"builder": "@angular-devkit/build-angular:dev-server",
"options":
"browserTarget": "some-app:build"
,
"configurations":
"production":
"browserTarget": "some-app:build:production"
,
"extract-i18n":
"builder": "@angular-devkit/build-angular:extract-i18n",
"options":
"browserTarget": "some-app:build"
,
"test":
"builder": "@angular-devkit/build-angular:karma",
"options":
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
]
,
"lint":
"builder": "@angular-devkit/build-angular:tslint",
"options":
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
,
"some-app-e2e":
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect":
"e2e":
"builder": "@angular-devkit/build-angular:protractor",
"options":
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "some-app:serve"
,
"configurations":
"production":
"devServerTarget": "some-app:serve:production"
,
"lint":
"builder": "@angular-devkit/build-angular:tslint",
"options":
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
,
"defaultProject": "some-app"
In case, it can also be fixed in nginx, this is my current settings file for the setup, which is included in the http
settings block in /etc/nginx/nginx.conf
:
map $http_upgrade $connection_upgrade
default upgrade;
'' close;
upstream websocket
server 127.0.0.1:4200;
server 127.0.0.1:4300;
server 127.0.0.1:5656;
server
listen 8002;
server_name localhost;
location ~ ^/api(.*)
proxy_pass http://127.0.0.1:8000$1$is_args$args;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/sockjs-node/
proxy_pass http://127.0.0.1:4200;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/collector/sockjs-node/
proxy_pass http://127.0.0.1:4300;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/collector(.*)
proxy_pass http://127.0.0.1:4300$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ^~ /push/
proxy_pass http://127.0.0.1:5656;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~
proxy_pass http://127.0.0.1:4200$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
angular nginx reverse-proxy
In order to have a production like setup, I want to hide all of the dev server enpoints of Angular and PHP behind an nginx reverse proxy (listening on port 8002).
For the most part this is working.
The API properly delivers its data and processes requests as expected.
The Angular dev servers also deliver their apps as expected.
The only issue I have is in regard to hot reloading of the second Angular dev server instance, as it only reloads on changes in the first instance.
The main angular app which runs on port 4200 works properly with hot reloading.
However, the second instance (running on port 4300) does not listen to the sockjs instance with the location ~ ^/collector/sockjs-node/
but to the location ~ ^/sockjs-node/
.
This surprises me, as the base in my index.html
is set to the correct path: <base href="/collector/">
.
So, I could conclude, that I (probably) have to change some setting in angular in order to get it to notify the app on a different endpoint.
My angular.json
is pretty much the auto generated config from the setup, except that I added the PWA package of angular.
My angular.json
is the following, with the app name replaced by 'some-app' as it is still in development and not published yet:
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects":
"some-app":
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics":
"@schematics/angular:component":
"style": "sass"
,
"architect":
"build":
"builder": "@angular-devkit/build-angular:browser",
"options":
"outputPath": "dist/some-app",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"src/styles.scss"
],
"scripts": [],
"es5BrowserSupport": true
,
"configurations":
"production":
"fileReplacements": [
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
],
"serviceWorker": true,
"ngswConfigPath": "src/ngsw-config.json"
,
"serve":
"builder": "@angular-devkit/build-angular:dev-server",
"options":
"browserTarget": "some-app:build"
,
"configurations":
"production":
"browserTarget": "some-app:build:production"
,
"extract-i18n":
"builder": "@angular-devkit/build-angular:extract-i18n",
"options":
"browserTarget": "some-app:build"
,
"test":
"builder": "@angular-devkit/build-angular:karma",
"options":
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
]
,
"lint":
"builder": "@angular-devkit/build-angular:tslint",
"options":
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
,
"some-app-e2e":
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect":
"e2e":
"builder": "@angular-devkit/build-angular:protractor",
"options":
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "some-app:serve"
,
"configurations":
"production":
"devServerTarget": "some-app:serve:production"
,
"lint":
"builder": "@angular-devkit/build-angular:tslint",
"options":
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
,
"defaultProject": "some-app"
In case, it can also be fixed in nginx, this is my current settings file for the setup, which is included in the http
settings block in /etc/nginx/nginx.conf
:
map $http_upgrade $connection_upgrade
default upgrade;
'' close;
upstream websocket
server 127.0.0.1:4200;
server 127.0.0.1:4300;
server 127.0.0.1:5656;
server
listen 8002;
server_name localhost;
location ~ ^/api(.*)
proxy_pass http://127.0.0.1:8000$1$is_args$args;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/sockjs-node/
proxy_pass http://127.0.0.1:4200;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/collector/sockjs-node/
proxy_pass http://127.0.0.1:4300;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~ ^/collector(.*)
proxy_pass http://127.0.0.1:4300$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ^~ /push/
proxy_pass http://127.0.0.1:5656;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location ~
proxy_pass http://127.0.0.1:4200$1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
angular nginx reverse-proxy
angular nginx reverse-proxy
edited Mar 22 at 16:52
joernneumeyer
asked Mar 22 at 16:34
joernneumeyerjoernneumeyer
2116
2116
Can you please add your angular.json file ?
– JFPicard
Mar 22 at 16:45
add a comment |
Can you please add your angular.json file ?
– JFPicard
Mar 22 at 16:45
Can you please add your angular.json file ?
– JFPicard
Mar 22 at 16:45
Can you please add your angular.json file ?
– JFPicard
Mar 22 at 16:45
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304076%2fhot-reload-on-second-angular-instance-is-only-performed-if-the-first-instance-is%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55304076%2fhot-reload-on-second-angular-instance-is-only-performed-if-the-first-instance-is%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you please add your angular.json file ?
– JFPicard
Mar 22 at 16:45