Hello community,

I'm using Phalcon as a front page controller (so nginx just forwards all requests to /index.php). The problem is I cannot access superglobals like $_GET. Both Phalcon's components like request or PHP raw superglobals are empty.

       $id = $this->request->getQuery('id'); //null
       $id = $_GET['id'];  //null      

I've tried accessing these vars on home page (index.php) and there it works:

    $id = $this->request->getQuery('id');
    var_dump($id, $_REQUEST, $_GET, $_POST) //all of them working fine

But, if I want to access request component or with plain $_GET anywhere else on site, those vars are not populated.

So I guess this is pretty logical, first page (landing page) which recieves direct input works fine, but once you forward calls to other controllers and actions they're lost ie. null since the child controllers and actions are not awere of it.

The only solution I can think of, would be to still populate _url at the end of each request, that would make Phalcon aware of inputs.

So the second configuration "Using $_SERVER['REQUEST_URI'] as source of URIs" presented here: https://docs.phalcon.io/en/latest/reference/nginx.html

Is useless, pretty much.

This configuration will pass REQUEST data to Phalcon, in var named _url :

    location / {
        try_files $uri $uri/ /index.php?_url=$uri&$args;
    }

Bottom note: I think this approach implemented in Phalcon is not the best out there. So we MUST rely on _url contents, since other internal components like 'request' are relying on the contents of this variable too.