Connect To A Docker Container Hosted Web App From LAN

From Littledamien Wiki
Jump to navigation Jump to search

Scenario[edit]

Developing a web app locally, and hosting that app in a Docker container.

This app can be accessed on the local machine with http://localhost

The goal is to access the local web app on another device on the same LAN as the development server, e.g. a phone or tablet.

Troubleshooting[edit]

ERR_CONNECTION_REFUSED[edit]

Loading the site using http://192.168.1.100 (or whatever the IP of the development server might be on the LAN) results in ERR_CONNECTION_REFUSED.

Running

$ curl http://192.168.1.100

Results in a 301 error response.

Fix[edit]

Check rules in the site's .htaccess file, where http requests may be forced into https requests. Allow the LAN IP to make http requests.