webapp: Use IP address, rather than localhost
since some systems may have configuration problems or other issues that prevent web browsers from connecting to the right localhost IP for the webapp. Tested on both ipv4 and ipv6 localhost. Url for the latter looks like: http://[::1]:50676
This commit is contained in:
parent
b78c71ca4c
commit
6f7ae84650
4 changed files with 18 additions and 12 deletions
|
@ -54,14 +54,14 @@ runBrowser url env = boolSystemEnv cmd [Param url] env
|
|||
|
||||
{- Binds to a socket on localhost, and runs a webapp on it.
|
||||
-
|
||||
- An IO action can also be run, to do something with the port number,
|
||||
- An IO action can also be run, to do something with the address,
|
||||
- such as start a web browser to view the webapp.
|
||||
-}
|
||||
runWebApp :: Wai.Application -> (PortNumber -> IO ()) -> IO ()
|
||||
runWebApp :: Wai.Application -> (SockAddr -> IO ()) -> IO ()
|
||||
runWebApp app observer = do
|
||||
sock <- localSocket
|
||||
void $ forkIO $ runSettingsSocket defaultSettings sock app
|
||||
observer =<< socketPort sock
|
||||
observer =<< getSocketName sock
|
||||
|
||||
{- Binds to a local socket, selecting any free port.
|
||||
-
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue