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

Function suggest_site_path has problem with nginx #1329

Open
mittus opened this issue Mar 10, 2020 · 10 comments
Open

Function suggest_site_path has problem with nginx #1329

mittus opened this issue Mar 10, 2020 · 10 comments

Comments

@mittus
Copy link

mittus commented Mar 10, 2020

Hello!! It's for GS 3.3.16

I use regexp on Nginx, my siteurl defined with $_SERVER['SERVER_NAME'] as regexp:
image

Can you change it to $_SERVER['HTTP_HOST'] ?
And can you remove error if I use only slash in the siteurl settings.php

@mittus mittus changed the title Function suggest_site_path problem with nginx Function suggest_site_path has problem with nginx Mar 10, 2020
@tablatronix
Copy link
Member

You can manually set your siteurl, hav you tried that?

@tablatronix
Copy link
Member

tablatronix commented Mar 10, 2020

Maybe I am thinking siteurl.. let me check, I dont think $_SERVER['HTTP_HOST'] is secure

@mittus
Copy link
Author

mittus commented Mar 10, 2020

I use "/" in hosts becouse work with git. Maybe can add parametr "allowed hosts" for GS and validate it for HTTP_HOST?

$allowed_hosts = array('foo.example.com', 'bar.example.com');
if (!isset($_SERVER['HTTP_HOST']) || !in_array($_SERVER['HTTP_HOST'], $allowed_hosts)) {
    header($_SERVER['SERVER_PROTOCOL'].' 400 Bad Request');
    exit;
}

@mittus
Copy link
Author

mittus commented Mar 10, 2020

I can create that functional and make function for conversion $SITEURL to fullpath if it has only slash in settings.php

Do it?

@tablatronix
Copy link
Member

Curious what exactly are you doing, I Just like to know use cases and what people are coming up with.

@tablatronix
Copy link
Member

Maybe we can add a global and if it is set return that instead and you can define this in gsconfig ?

GSSERVERNAME = $_SERVER['SERVER_NAME'];

@mittus
Copy link
Author

mittus commented Mar 10, 2020

Done.

With $SITEURL I think, that it need be changed to the $fullpacth anywhere, where needed absolute patch.

@tablatronix
Copy link
Member

This is probably a little different in 3.4 as some work has been done for relative paths etc.

@mittus
Copy link
Author

mittus commented Mar 11, 2020

What you think about this hotfixes for 3.3.16? I do not plan to update released sites to 3.4 and this problem remains for them

@tablatronix
Copy link
Member

I will have to implement it as an optional toggle or something, not just that. And I need a better description of what you are doing, so we can document it

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

2 participants