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

[RTM] Feature/trusted proxy support #176

Merged
merged 3 commits into from
Apr 10, 2015
Merged

[RTM] Feature/trusted proxy support #176

merged 3 commits into from
Apr 10, 2015

Conversation

Toflar
Copy link
Member

@Toflar Toflar commented Apr 8, 2015

This is a PR for #128. I checked the code and imho our legacy code does exactly what Symfony's Request::getClientIp() does.

Please double check this though :)

@aschempp
Copy link
Member

aschempp commented Apr 8, 2015

I've noticed that too in https://github.com/contao/core-bundle/pull/72/files#diff-2f0eb5d18e0f5fb0dbaef526bb165d41R305

Should we add the TL_CONFIG variable for BC? We currently do that for all other variables, and I do have some customization where I use the variable.

@Toflar
Copy link
Member Author

Toflar commented Apr 9, 2015

Should we add the TL_CONFIG variable for BC? We currently do that for all other variables, and I do have some customization where I use the variable.

BC of what? What would it help to add the variable?

@aschempp
Copy link
Member

aschempp commented Apr 9, 2015

@Toflar
Copy link
Member Author

Toflar commented Apr 9, 2015

But what does it help? It sets a TL_CONFIG value that is never used.

@aschempp
Copy link
Member

aschempp commented Apr 9, 2015

We don't know if extension developers used it. Same with SMTP, it's unlikely someone used it because the Email class does automatically use it, but it would not harm to add it for the sake of completeness.

@Toflar
Copy link
Member Author

Toflar commented Apr 9, 2015

But it's not really possible because we did not support all the notations IpUtils supports. One can configure an IP range in the trusted_proxy settings and we would need to resolve this to a list of comma separated IP's to set that value. I mean, of course it's possible but is it worth the effort?

@aschempp
Copy link
Member

aschempp commented Apr 9, 2015

That's true, assuming people will start using IP ranges…

@leofeyer
Copy link
Member

leofeyer commented Apr 9, 2015

Looks good to me. Let me know when it is RTM :)

@Toflar Toflar changed the title [RFC] Feature/trusted proxy support [RTM] Feature/trusted proxy support Apr 9, 2015
@Toflar
Copy link
Member Author

Toflar commented Apr 9, 2015

Okay for you and @aschempp so it's RTM for me :)

@leofeyer
Copy link
Member

leofeyer commented Apr 9, 2015

Merging this will invalidate #128, right?

@leofeyer leofeyer added this to the 4.0.0 milestone Apr 9, 2015
@leofeyer leofeyer self-assigned this Apr 9, 2015
@Toflar
Copy link
Member Author

Toflar commented Apr 9, 2015 via email

@aschempp
Copy link
Member

aschempp commented Apr 9, 2015

We should also close my PR in contao/core for ip-range support and mention this

@leofeyer
Copy link
Member

leofeyer commented Apr 9, 2015

Can you fix the tests please?

PHP Fatal error:  Call to a member function getContainer() on null in /var/www/contao/standard-edition/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Environment.php on line 376

The method is probably missing in our kernel mock.

@aschempp
Copy link
Member

aschempp commented Apr 9, 2015

global $kernel is missing ;)

@Toflar
Copy link
Member Author

Toflar commented Apr 9, 2015

Fixed. But now I have a new problem that's probably caused by some component overriding the $_SERVER or whatever. I can't find the issue...

@aschempp
Copy link
Member

aschempp commented Apr 9, 2015

@Toflar
Copy link
Member Author

Toflar commented Apr 9, 2015

True, why is this?

@aschempp
Copy link
Member

aschempp commented Apr 9, 2015

I guess because a default value is alway necessary…

Maybe we should change that to something like this:

if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
    $_SERVER['HTTP_ACCEPT_LANGUAGE'] = '';
}

@leofeyer
Copy link
Member

leofeyer commented Apr 9, 2015

I have no idea. I think the mockKernel() method is from @discordier?

@leofeyer
Copy link
Member

leofeyer commented Apr 9, 2015

Do the tests still work if you remove the line?

@discordier
Copy link
Contributor

Having similar issues in my pr. Stay tuned. Will search a solution tomorrow.

@leofeyer leofeyer merged commit e956e10 into contao:develop Apr 10, 2015
@leofeyer
Copy link
Member

I have fixed the tests and merged the PR in c375b7c.

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

Successfully merging this pull request may close these issues.

None yet

4 participants