Sending 204 responses from your script means that your instance still needs to be launched and costs you money. If you are looking for a caching solution. Google got it and called Edge Cache.
You only need to answer with the following headers, and Google will automatically cache your response on several servers closest to the users (i.e. respond with 204). This will significantly increase the speed of your site and reduce the cost of the instance.
w.Header().Set("Cache-Control", "public, max-age=86400") w.Header().Set("Pragma", "Public")
You can set the maximum age, but do it wisely.
By the way, it seems that billing should be enabled to use the edge cache
source share