Search code examples
swiftrealmrealm-mobile-platform

Is it possible to use Realm Mobile Platform sync server on port 80?


I would like to use the Realm Mobile Platform sync server over public wifi with only port 80 open in the firewall.

Is it possible to configure Realm Mobile Platform (Realm Object Server) and client API to work across port 80 rather than the default 9080?


Solution

  • The docs say:

    You must also choose a port number above 1024, as the Realm Object Server does not run as root. It is recommended to use the default port (9443).

    If you would like to be able to connect to Realm Object Server on a port lower than 1024, such as the default HTTPS port 443, you can forward traffic to the port that Realm Object Server is listening on:

    sudo iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 9443

    So to successfully connect using port 80, you can leave the default http. listen_port at 9080 and run this command:

    sudo iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 9080