Port Forwarding Troubleshooting

RESTfm will function behind a router with Network Address Translation and Port Forwarding capabilities. (Please take time to consider the security implications before doing this.)

Please note that the term router is used, where the network gateway device may also be known as a modem or a firewall.

In the case where the RESTfm/report.php page shows no critical errors from connections within the local network (LAN), but does show critical errors when the connection is from outside (WAN), some additional configuration may be needed (see below). Generally this is just cosmetic and RESTfm will otherwise still function correctly for WAN connections, in which case the errors may be safely ignored (along with the remainder of this page).

Support for reading containers behind a Port Forwarding router:

Support for reading containers poses an additional complication when port forwarding. Container fields are returned as a URL and the client application uses this URL to read the actual container contents directly from FileMaker Server. The configured hostspec in RESTfm.ini.php is used by the FileMaker PHP API to construct the container URL.

Please note that the term "external hostname/address" in the following text, means the Fully Qualified Domain Name (FQDN) or IP Address used to connect to the forwarded ports on the router from outside the network (WAN).

Option 1) Enable NAT loopback in the router, and set hostspec to the external hostname/address.

Many (but not all) routers support "NAT loopback", also known as "hairpinning". This allows a LAN client to establish a connection to a LAN server by connecting to the external hostname/address (and forwarded ports) on the router. Consult the router documentation to determine if this feature is available.

  1. Enable NAT loopback on the router.
  2. Set hostspec (in RESTfm.ini.php) to the external hostname/address (and possibly port number). e.g. https://fms.example.com:4343
  3. Check that the RESTfm/report.php page does not show any critical errors.

Option 2) Rewrite the received container URL to use the external hostname/address in the client application.

In this scenario, no adjustment to RESTfm is necessary. With default settings, a container field would return a container URL in the following form: http://127.0.0.1/fmi/xml/cnt/...

Before trying to access the container data, the client application must rewrite the container URL by replacing the http://127.0.0.1 part with the correct external hostname/address and ports:https://fms.example.com:4343/fmi/xml/cnt/...

Option 3) Configure LAN DNS to resolve the external hostname to the internal IP Address.

A LAN DNS server may be utilised to resolve a FQDN (Fully Qualified Domain Name) to an internal IP address. This presents a consistent hostname to both LAN and WAN clients.

Prerequisites:

  1. The router's external IP Address must be resolvable through DNS. e.g. fms.example.com
  2. The forwarded port number(s) must be the same as used by FileMaker Server on the LAN. FileMaker Server deployment offers alternative ports for both http and https.
  3. An internal (LAN) DNS server (some routers offer this function).

Steps:

  1. Configure LAN DNS to resolve external hostname to RESTfm's internal IP address. e.g. fms.example.com -> 192.168.0.5
    (All LAN devices connecting to RESTfm will need to be using the LAN DNS.)
  2. Set hostspec (in RESTfm.ini.php) to the external hostname (and possibly port number). e.g. https://fms.example.com:4343
  3. Check that the RESTfm/report.php page does not show any critical errors.

Note: On small LANs, without a LAN DNS, it may be possible to achieve the same function by adding an entry to the Operating System's "hosts file" (on every LAN system). This is not possible with mobile devices such as tablets and phones though.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us