Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mikespub opened this issue Apr 25, 2024 · 1 comment
Open

Comments

@mikespub
Copy link

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...

@mikespub
Copy link
Author

Another example: default.conf.sample

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant