Offline mode in OS X

When working on web apps we have to keep in mind that the client might not have access to the internet all the time. Chrome has a great feature for this:
Chrome network settings

When working on a web app that make requests to a API located at localhost but also make requests to external API:s, it’s harder.
I solved this issue by creating a new Location in OS X Network part of System Preferences. The new Location has WiFi and Ethernet Configure IPv4 set to Off, which means that it’s offline but you can still reach your localhost server.

OS X Network Location

Good times!