Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core using multiple urls in single application

I'm creating new ASP.NET Core application and it run on https://localhost:44382/. I want to set multiple urls to browse my application like site1.testing.com, site2.testing.com, site3.tseting.com.

Everytime I browser those urls , I want to redirect to my application.
I found this setting in launchSetting.json

 "myCoreApp": {
  "commandName": "Project",
  "launchBrowser": true,
  "applicationUrl": "https://localhost:5001;http://localhost:5000",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
}

as you see

"applicationUrl": "https://localhost:5001;http://localhost:5000",

By referencing this , I've tried changing in this setting and doesn't work.

like image 395
Steven Sann Avatar asked Oct 20 '25 09:10

Steven Sann


1 Answers

You cannot declare more than 1 URL for HTTP, and 1 URL for HTTPS protocol. (exclude case: you use different environment parameter).

Recommend for you (also is best practice):

  • Use NGINX server block, or
  • Apache HTTP Server virtual host.

Reference:

  • https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/
  • https://httpd.apache.org/docs/2.4/vhosts/examples.html
  • https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/launchsettings.json#L99
like image 74
Do Nhu Vy Avatar answered Oct 24 '25 06:10

Do Nhu Vy