title: Why app engine ignore PORT env variable in app.yaml
body: <p>I am trying to migrate from Go 1.9 to Go 1.11. I copied the main function from <a href="https://cloud.google.com/appengine/docs/standard/go111/go-differences#importing-appengine-sdk" rel="nofollow noreferrer">the migration document</a></p>
  
  <p>This is my app.yaml</p>
  
  <pre><code>runtime: go111
  env: standard
  instance_class: F1
  handlers:
    - url: /.*
      script: auto
      secure: always
      redirect_http_response_code: '301'
    - url: .*
      script: auto
  env_variables:
    PORT: '443'
  </code></pre>
  
  <p>This is my main function</p>
  
  <pre><code>func main() {
      http.HandleFunc("/demo", demoHandler)
  
      port := os.Getenv("PORT")
      if port == "" {
              port = "443"
              syslog.Printf("Defaulting to port %s", port)
      }
  
      syslog.Printf("Listening on port %s", port)
      syslog.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
  }
  </code></pre>
  
  <p>My application needs to run on port 443 with HTTPS. However, after deployment, the application doesn't respond. I checked the logs, and it says "Listening on port 8081". I don't understand why it takes 8081 instead of 443. Where is this 8081 from?</p>
  
  <p>If I hardcode the main function to use port 443. It gives me this in the logs "App is listening on port 443, it should instead listen on the port defined by the PORT environment variable. As a consequence, nginx cannot be started. Performance may be degraded. Please listen on the port defined by the PORT environment variable."</p>
  
  <p>What do I miss here?</p>