问题
I want to run a node js application on Google App Engine but my application is currently running two protocols, on two different ports. One of them is the port 8080 (which is required to work on Google App Engine) and the other one is 1883, a mqtt server. Looking the documentation, I couldn't find anything to make this works, actually, the server starts without errors but of course I can't connect to the port 1883, only the http and https.
I need to know if this is possible at all and if is, how do I forward that port or proxy that?
My app.yaml:
runtime: nodejs
env: flex
service: comms-server
network:
name: default
subnetwork_name: default
forwarded_ports:
- 1883/tcp
Also, my VPC configuration is:
回答1:
Try the following:
network:
forwarded_ports:
- 1883
instance_tag: comms-server
And:
gcloud compute firewall-rules create default-allow-comms-server \
--allow tcp:1883 \
--target-tags comms-server \
--description "Allow traffic on port 1883"
来源:https://stackoverflow.com/questions/54739590/google-app-engine-two-ports-on-same-application