cain
cain

Reputation: 739

Angular 7 - Can we remove Port number

I am using Angular with ASP.Net Web application. When i am using ng build App build and run on URL without port number. But if i run app using ng serve its open with a port number.

i know that i can change port number and host name on angular.json file,

"serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "options": {
        "browserTarget": "ng-app:build",
            "port": 4200,
            "host": "myapp.withAspweb.local"

      },

Is that possible to remove port number from URL.

ng server - myapp.withAspweb.local:4200
ng build - myapp.withAspweb.local

Upvotes: 1

Views: 747

Answers (2)

Anders
Anders

Reputation: 700

You can always configure the port to be 80 in your angular.json-file, as you already mention.

In regards to changing your hostname, I'd suggest you set it to 0.0.0.0 (any incoming host) and modify your hosts file (located in C:\Windows\System32\drivers\etc\hosts) to provide the desired hostname.

Upvotes: 0

hansmaad
hansmaad

Reputation: 18915

There is no such thing as "no port". The default http port is 80, so just try

"port": 80

Upvotes: 1

Related Questions