I want to access a website and an API both running in Docker containers behind another nginx Docker container (reverse proxy managing SSL) from an iOS device.

So I have:
1 iOS device having IP
1 MacBook Pro having IP
1 Docker container running nginx having two server_name settings: app.dev and api.dev, both using self-signed SSL certificates /etc/hosts points has these entries: app.dev api.dev

~/proxy.pac contains these entries:

function FindProxyForURL(url, host){
  if (shExpMatch(host, "app.dev")) {
    return "PROXY app.dev:443; DIRECT";
  if (shExpMatch(host, "api.dev")) {
    return "PROXY api.dev:443; DIRECT";
  return "DIRECT";

Squidman is configured on port 9090 and allowed clients are

Squidman template allows access to localhost

# protect web apps running on the proxy host from external users
# http_access deny to_localhost

# rules for client access go here
http_access allow localhost

The iOS device proxy is configured as, port 9090.

The MacBooks Networks Automatic Proxy Configuration points to the ~/proxy.pac file.

I can browse web sites from the iOS website like http://apple.com.

I can browse https://app.dev and call https://api.dev from the MacBook.

I cannot browse https://app.dev nor call https://api.dev from the iOS device.

What am I doing wrong?

  • Tried this already with /etc/hosts but using /private/etc/hosts/ didn't fix it neither. – Alexander Zeitler Mar 18 '17 at 19:30
  • I'm gonna set it up in a virtual environment to comprehend your problem – klanomath Mar 18 '17 at 19:32
  • Do you have a quick setup guide (or other instructions) to install the reverse proxy (SSL) docker image (which one did you use?) and the other two nginx docker images? – klanomath Mar 18 '17 at 21:53
  • Check out xip.io next time - often far easier to just use FQDN for all the non-routable IP you need for proxies, containers, VM and devices to test. – bmike Apr 23 '17 at 20:58

I solved it using this Docker container: https://github.com/jpillora/docker-dnsmasq

Simply follow the instructions and add e.g. app.dev and api.dev to your /etc/hosts.

Then change the DNS on the macOS and iOS device to (following the initial question).

| improve this answer | |

[on hold (the answer is right under certain circumstances but sometimes wrong) - under construction]

iOS has no clue where and what api.dev and app.dev are. The entries in the hosts file are valid for the local host only.

Since you can't modify iOS' hosts file without jailbreaking the iOS device you have to set up a DNS-server (e.g. brew + dnsmasq) on your MacBook Pro and point iOS' DNS setting to it.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .