title: POST Request gives timeout when testing on iPhone device
body: <p>I'm working on a school project, which is developing a Web application with an API and an iPhone app with swift. I developed the website in Laravel with Homestead/Vagrant. </p>
  
  <p>But when it comes to the iPhone app, i'm facing with a problem:
  When a user presses the login button the app sends a http POST request to the API and the API checks if the users exists in the db, if so then it will return a token, after which the user will be redirected to the dashboard. This works fine on the xcode simulator. </p>
  
  <p>My code of the request part looks like this:</p>
  
  <pre><code>var loginUrl = "http://10.1.1.33/api/login" + "?email=" + self.email + "&amp;password=" + self.password
  
  let request = NSMutableURLRequest(URL: NSURL(string: loginUrl)!)
  
              let session = NSURLSession.sharedSession()
              request.HTTPMethod = "POST"
  
              let task = session.dataTaskWithRequest(request, completionHandler: {
                  data, response, error -&gt; Void in
  
                  guard error == nil else {
                      print("First Error!!! \(error)")
                      self.errorLabel.text = "Request timed Out"
                      self.enableLoginBtn(true, buttonText: "Login")
  
                      return
                  }
  
                  do {
                      let data: AnyObject? = try NSJSONSerialization.JSONObjectWithData(data!, options: [])
                      // Okay, the `json` is here, let's get the value for 'success' out of it
  
                      let json = JSON(data!)
  
                      dispatch_async(dispatch_get_main_queue(), {
  
                          if json["token"] != nil {
  
                              print("Login successvol!)")
  
  
                              if self.saveSession(json["token"].string!) {
                                  self.enableLoginBtn(true, buttonText: "Login")
                                  self.goToDashboard()
                              }else {
                                  print("Saving token went wrong")
                              }
  
  
                          }else {
                              self.showError("Gebruikersnaam of wachtwoord is onjuist")
                              self.enableLoginBtn(true, buttonText: "Login")
                          }
  
                      })
  
  
                  }catch let parseError{
                      print(parseError)
                      let jsonStr = NSString(data: data!, encoding: NSUTF8StringEncoding)
                      print("Error could not parse JSON: \(jsonStr)")
                      self.enableLoginBtn(true, buttonText: "Login")
                  }
              })
  
              task.resume()
  </code></pre>
  
  <p>But when i try to test the exact same thing on my iPhone 5s (I have a developer license) it's failing every single time. The error i'm getting is: </p>
  
  <blockquote>
    <p>Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x1742e1e80 {NSUnderlyingError=0x170259230 "The operation
    couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)",
    NSErrorFailingURLStringKey=<a href="http://10.1.1.33/api/login?email=jejz@kdk.nl&amp;password=sndxbdj" rel="nofollow noreferrer">http://10.1.1.33/api/login?email=jejz@kdk.nl&amp;password=sndxbdj</a>,
    NSErrorFailingURLKey=<a href="http://10.1.1.33/api/login?email=jejz@kdk.nl&amp;password=sndxbdj" rel="nofollow noreferrer">http://10.1.1.33/api/login?email=jejz@kdk.nl&amp;password=sndxbdj</a>,
    NSLocalizedDescription=The request timed out.}</p>
  </blockquote>
  
  <p>The last couple days i searched the whole internet for a solution, but i couldn't find any solution. </p>
  
  <p>I'd be really grateful if someone can help me out with this. </p>
  
  <p>Thanks in advance.</p>
  
  <p>Best regards</p>
  
  <p>EDITED ---------------------
  <strong>Screenshot of the error</strong>
  <a href="https://i.stack.imgur.com/TnL44.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TnL44.png" alt="enter image description here"></a></p>