# Http get Request always must fired twice to work? Help pls

**URL:** <https://forum.ionicframework.com/t/http-get-request-always-must-fired-twice-to-work-help-pls/78155>\
**Category:** ionic-v3\
**Created:** [February 2, 2017, 10:42am UTC](https://forum.ionicframework.com/t/http-get-request-always-must-fired-twice-to-work-help-pls/78155 "2017-02-02T10:42:53Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![anon22300522](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@anon22300522](https://forum.ionicframework.com/u/anon22300522)\
**Post date:** [February 3, 2017, 10:00am UTC](https://forum.ionicframework.com/t/http-get-request-always-must-fired-twice-to-work-help-pls/78155/16 "2017-02-03T10:00:21Z")

</div>

@mich356c  
Well i tried to test my new code now on a real android device with a real apk. But the http request doesnt work anymore. So i debugged it in firefox and got this output of the console whitch i think is the problem that causes my login issue on devices:

> Request denied: … CORS-Header ‘Access-Control-Allow-Origin’ missing

How can i resolove this issue?

**EDIT:** Ok i can login now in Browser by adding this to my api.php file:

> if (isset($\_SERVER[‘HTTP\_ORIGIN’])) {  
> header(“Access-Control-Allow-Origin: {$\_SERVER[‘HTTP\_ORIGIN’]}”);  
> header(‘Access-Control-Allow-Credentials: true’);  
> header(‘Access-Control-Max-Age: 86400’); // cache for 1 day  
> }
> 
> ```
> // Access-Control headers are received during OPTIONS requests
> if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
> 
> if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
> header("Access-Control-Allow-Methods: GET, POST, OPTIONS");         
> 
> if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
> header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
> 
> exit(0);
> }
> 
> ```

Refering to this link: [Posting data from Ionic app to PHP server – Nikola Brežnjak blog](http://www.nikola-breznjak.com/blog/codeproject/posting-data-from-ionic-app-to-php-server/) and this forum thread: [$http No 'Access-Control-Allow-Origin' problem on POST - #6 by Hitman666](https://forum.ionicframework.com/t/http-no-access-control-allow-origin-problem-on-post/5625/6)

But i still cant login on my real device…

---

_[View the full topic](https://forum.ionicframework.com/t/http-get-request-always-must-fired-twice-to-work-help-pls/78155)._
