Skip to content

Instantly share code, notes, and snippets.

@imekachi
Last active July 4, 2018 10:07
Show Gist options
  • Save imekachi/9c87af605747d6bc1bfd7b512cb8e355 to your computer and use it in GitHub Desktop.
Save imekachi/9c87af605747d6bc1bfd7b512cb8e355 to your computer and use it in GitHub Desktop.
Accessing local servers from Android/Mobile device with custom domain, Use pc as DNS server for mobile in the same LAN.

On PC/Mac

  1. You have to run proxy server on you machine. Download SquidMan UI app of squid proxy. (Unfortunately this app is MacOS only. For Windows user, try alternative proxy server app)
  2. Setting up, at Preferences > General set desire port for proxy server to HTTP Port: (default is 8080)
  3. Config ip addresses that can access this proxy in Preferences > Clients
    • press New
    • enter ip and subnet you want ie. 192.168.1.0/24
  4. Disable localhost apps protection, go to Preferences > Template scroll and find http_access deny to_localhost and comment the line by adding # in front of it.
    # protect web apps running on the proxy host from external users
    # http_access deny to_localhost
    
  5. Hit Save
  6. At main window, press Start Squid

On Mobile

in example I'm using an android phone. iOS settings will be similar.

  1. Connect to the same wifi as your PC.
  2. Settings > WiFi and long press on connected wifi name, select Manage network settings.
  3. on Proxy section, select Manual
  4. on Proxy host name: enter your PC ip address or machine name
  5. on Proxy port: enter the port you entered in SquidMan (default is 8080)
  6. hit Save.
  7. try to open url of your local server in mobile browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment