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

Get rid of TYPO3 trustedHostsPattern warning, fixes #1739 #1741

Merged
merged 4 commits into from
Jul 29, 2019
Merged

Get rid of TYPO3 trustedHostsPattern warning, fixes #1739 #1741

merged 4 commits into from
Jul 29, 2019

Conversation

jonaseberle
Copy link
Collaborator

This sets trustedHostsPattern to all configured hosts + "localhost" and "127.0.0.1".

Please excuse my zero Go skills and correct me where needed.

The Problem/Issue/Bug:

How this PR Solves The Problem:

Manual Testing Instructions:

Automated Testing Overview:

Related Issue Link(s):

Release/Deployment notes:

This sets trustedHostsPattern to all configured hosts + "localhost" and "127.0.0.1".
pkg/ddevapp/typo3.go Outdated Show resolved Hide resolved
@jonaseberle
Copy link
Collaborator Author

Please standby. I discovered a problem with 127.0.0.1:..

Port numbers are appended to HTTP_HOST if they are non-standard.
They could theoretically be extracted from app.GetAllURLs() but I am not sure if it would be enough to just strip `http://`/ `https://` from these values or if they might also be followed by a path.
This takes a shortcut and does not whitelist the actual ports but rather allows ALL ports. I guess this is reasonable to keep the code simple.
…rIP() to get host's interface IP

The output containing the backslashed looks like that:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = 't3-master.ddev.site(:\\d+)?|localhost(:\\d+)?|127.0.0.1(:\\d+)?';
Copy link
Member

@rfay rfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's a simpler and more readable regex. With just a single hostname we get $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = 't3v9.ddev.site(:\\d+)?|localhost(:\\d+)?|127.0.0.1(:\\d+)?';, which is pretty mind-boggling.

Could we do something like (host1.ddev.site|host2.ddev.site|host3.ddev.site|127.0.0.1|<docker ip>):?[0-9]*

@jonaseberle
Copy link
Collaborator Author

Yes, sure. That works, too :)

Copy link
Member

@rfay rfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and worked perfectly for me. I added lots of hostnames, etc, and using @jonaseberle 's TYPO3 patch from https://review.typo3.org/c/Packages/TYPO3.CMS/+/61374 it resulted in a completely clean https install. Thanks! Amazing work.

@rfay rfay merged commit 2ad94a0 into ddev:master Jul 29, 2019
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

Successfully merging this pull request may close these issues.

2 participants