chromeos - chrome can't reach 127.0.0.1:8080

Viewed 2245

I am on chromebook and testing php web server from Termux via

php -S 127.0.0.1:8080 -t /sdcard/Download/webserver

I tried to open the webpage in Chrome (127.0.0.1:8080) but it returned this error message: ERR_CONNECTION_REFUSED. It works on Firefox and even Chrome Beta browsers via android so I know the web server is up and running. I've cleared caches, flushed DNS and done whatever solutions google search came up with and none works. What's up with Chrome? Any solution?

3 Answers

What I did was termux pkg install iproute2 and run ip --json addr show eth0

This clearly and reliably dumps the ipaddress in JSON format to ip.json.

Example:

import { execSync } from 'child_process'
import { readFile } from 'fs'
const ipShowRaw = execSync('ip --json addr show eth0', {encoding: 'utf-8'})
// readFile('./ip.json', {encoding: 'utf-8'}, (e, data) => ipShow = JSON.parse(data))
const ipShow = JSON.parse(ipShowRaw)
const ip = ipShow[0]['addr_info'][0].local

console.log(ip)

From running from bash:

~ $ pkg install iproute2
~ $ node getIp.mjs
100.115.92.2
~ $ xdg-open 'http://100.115.92.2:8080'

The last line will typically open a new tab on ChromeOS's chrome.

Local domains to be accessed is probably not allowed in your chrome. Go to chrome://flags and set "Built-in Asynchronous DNS" to "Disabled", then restart the browser.

Have a look at this link as well.

Related