Relive the scene of the tragedy

This is a common Go Web development time firewall prompt; The Gin sample code is as follows:

	engine := gin.Default()
	engine.GET("/health".func(ctx *gin.Context) {
		ctx.String(http.StatusOK, "up")
	})
	_ = engine.Run()
Copy the code

Hot yao problem comes, occasionally appear hint this, point permit also went.

But if the development phase, countless debug every day, this product appears a hundred and eighty times, it is very cool to think

The rectification

Instead, change the startup host header to localhost.

The MacOS firewall will consider any host header that is not a localhost to be a malicious connection (especially if it is initiated actively).

The following changes are made:

_ = engine.Run("localhost:")
Copy the code