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

Missing SERVER_NAME causes routing to fail #1060

Closed
marcovn opened this issue Aug 22, 2017 · 1 comment
Closed

Missing SERVER_NAME causes routing to fail #1060

marcovn opened this issue Aug 22, 2017 · 1 comment

Comments

@marcovn
Copy link

marcovn commented Aug 22, 2017

Hey,

Just something I ran in today that needs mentioning. My stack currently consists of a NGINX/fastcgi/php setup (using docker images).

Noticed that after updating from 3.6.1 to 3.6.2. all my routes where failing with a 404. After some digging around I tracked it to line 2251 in base.php

$uri=parse_url((preg_match('/^\w+:\/\//',$_SERVER['REQUEST_URI'])?'': '//'.$_SERVER['SERVER_NAME']).$_SERVER['REQUEST_URI']);

The parse_url fails when $_SERVER['SERVER_NAME'] is empty: it cannot handle relative URLs. This also is an issue in 3.6.1 (and possibly earlier versions) which I was using, but it did not cause any routes to fail in my case.

Solution was to explicitly set the SERVER_NAME in your nginx.conf like this:

fastcgi_param SERVER_NAME some_host_name;

Hope this helps somebody!

@xfra35
Copy link
Collaborator

xfra35 commented Mar 14, 2018

The case where SERVER_NAME is set to an empty string (which seems to be quite common with Nginx) is now taken into account.
See #1084

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

No branches or pull requests

3 participants