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

Scheme detection problem #3668

Open
thebodzio opened this issue Jan 2, 2023 · 0 comments
Open

Scheme detection problem #3668

thebodzio opened this issue Jan 2, 2023 · 0 comments

Comments

@thebodzio
Copy link
Contributor

It is not a Grav issue per se, since it originates in psr7-server/ServerRequestCreator.php. I reported the issue upstream, but I have no way of knowing if it will be resolved there and in the meantime it will keep affecting Grav anyway.

To the point: recently I have installed Grav on a server which reports both $_SERVER['HTTPS'] as on and at the same time $_SERVER['REQUEST_SCHEME'] as http. I should add that on this setup I am using Grav with HTTPS exclusively. The problem manifests itself when a trailing slash redirection is on, so, for example, on admin login page or on any page with a trailing slash, for that matter, like https://example.com/about/. The latter will be redirected to http://example.com:443/about which causes the 400 error. The direct cause of this is the way the $request object is initialized and psr7's URI scheme is detected. It's in this fragment of https://github.com/Nyholm/psr7-server/blob/master/src/ServerRequestCreator.php:

https://github.com/Nyholm/psr7-server/blob/b846a689844cef114e8079d8c80f0afd96745ae3/src/ServerRequestCreator.php#L272-L276

It sets URI's scheme as http regardless of the fact that HTTPS header is on and port is 443. I tried to modify the URI using withScheme() method in handleRedirectRequest() in InitializeProcessor, but it didn't change the scheme.

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