Skip to content

Weird PSR-7 request target for current nginx default.conf with path info #175

Closed
@mikespub

Description

@mikespub

When I'm using a PSR-7 front controller to handle requests like "/login/", the value it gets with $request->getRequestTarget() is actually "/login/?q=/login/&"

I don't know much about nginx configuration, but this may be due to the nginx default.conf combining

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

together with

location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        //...
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
}

It's easily covered in PHP code once you know that, but this was somewhat unexpected...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions