【发布时间】:2017-06-14 09:09:38
【问题描述】:
我想通过公共 wifi 使用 Realm Mobile Platform 同步服务器,防火墙中只打开端口 80。
是否可以将 Realm 移动平台(Realm 对象服务器)和客户端 API 配置为跨端口 80 而不是默认的 9080 工作?
【问题讨论】:
标签: swift realm realm-mobile-platform
我想通过公共 wifi 使用 Realm Mobile Platform 同步服务器,防火墙中只打开端口 80。
是否可以将 Realm 移动平台(Realm 对象服务器)和客户端 API 配置为跨端口 80 而不是默认的 9080 工作?
【问题讨论】:
标签: swift realm realm-mobile-platform
是的。可以通过适当地设置configuration.yml 来更改端口。
请参阅configuration.yml 上的proxy、network 和sync 部分。
以下是configuration.yml的摘录。
...
proxy:
http:
listen_address: '::'
## The port that the HTTP proxy module should bind to.
# listen_port: 9080
https:
## The port that the HTTPS proxy module should bind to.
# listen_port: 9443
network:
http:
## The port on which to listen for incoming requests to the Dashboard
## and authentication APIs. This defaults to 27080.
# listen_port: 27080
sync:
## Synchronization service settings, including clustering and load balancing.
servers:
...
【讨论】:
docs 说:
您还必须选择 1024 以上的端口号作为 Realm Object 服务器不以 root 身份运行。建议使用默认端口 (9443)。
如果您希望能够连接到 Realm Object Server 低于 1024 的端口,如默认 HTTPS 端口 443,可以 将流量转发到 Realm Object Server 正在侦听的端口:
sudo iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 9443
所以要使用 80 端口成功连接,你可以保留默认的 http。 listen_port 在 9080 并运行以下命令:
sudo iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 9080
【讨论】: