I\'m deploying a Java app that runs on port 8761, and works fine on localhost. Although when I push to App Engine flexible environment, I get a HTTP 502 server error.
I think you need to use the network settings section in the app.yaml config file:
app.yaml
network: forwarded_ports: - 8761/tcp
You might also need to set firewall rules in the Cloud Platform Console.