Shopify / slate

Slate is a toolkit for developing Shopify themes. It's designed to assist your workflow and speed up the process of developing, testing, and deploying themes.
https://shopify.github.io/slate
MIT License
1.28k stars 363 forks source link

Asset Server always binds to en0, even if it is not the "default" network interface. #1082

Open lastobelus opened 4 years ago

lastobelus commented 4 years ago

Problem

The asset server always binds to the lowest numbered interface, even if it is not the default interface (i.e., the top interface in OS X Network preference pane). The ssl-check script, however, will create certs for the default interface. This will cause styles and js to be broken during local development.

Replication steps

More Information

I poked around with node-ip to see if there was a way to properly detect the ethernet interface set to default rather than the lowest one, but I did not find one (although you can ask for the address of a particular interface)

Instead I was able to workaround by changing the ssl-check script to add the ip addresses from all interfaces from en0 to en10 (this might be a security issue if one of those interfaces has external access):

interfaces=($(seq 0 1 10))
domains=(
    "localhost"
)

for interface in ${interfaces[@]}; do
    local_ip=$(ipconfig getifaddr en$interface)
    domains+=( $local_ip )
done