Valmir Júnior
Valmir Júnior

Reputation: 47

Google Cloud Linux VM won't allow HTTP access event though firewall is configured

I recently created a VM instance at Google Cloud with the O.S. being a Ubuntu 18.04.5 and the instance seems pretty ok. I cloned a git repository and put a .NET Core API to run locally as it can be seen in the screen capture bellow.

Terminal running application

I then added a firewall rule to the Virtual Machine VPC allowing HTTP connections to be done through these ports as the screen capture bellow shows.

VPC Firewall configuration

As it can be seen, it should be applied to all instance in the network from every source and I made sure to open it outbound and inbound while trying to troubleshoot. Anyway, when i try to access it (Swagger UI) with my browser it says that it isn't able to connect and even telnet command is running into timeout.

May I have to do any configuration else? Am I misleading something? What could it be?

Upvotes: 1

Views: 340

Answers (1)

Valmir Júnior
Valmir Júnior

Reputation: 47

For posterity searches, all it took was to change my launchSettings to force my server to listen on 0.0.0.0 instead of localhost. To achieve that, I update my launchSettings.json file from:

"Api": {
  "commandName": "Project",
  "launchBrowser": true,
  "launchUrl": "https://localhost:44395/",
  "applicationUrl": "https://localhost:44395/",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
}

to:

"Api": {
  "commandName": "Project",
  "launchBrowser": true,
  "launchUrl": "https://0.0.0.0:44395/",
  "applicationUrl": "https://0.0.0.0:44395/",
  "environmentVariables": {
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
}

Upvotes: 2

Related Questions