-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Fix issue working with non-standard ports #16455
Conversation
d24ca1a
to
c1b07af
Compare
@dimasites — can you review and sign the CLA at https://modx.com/community/cla-introduction/ so we can consider getting this contribution into the next release? |
Hi @opengeek i signed it via gitgub's And if you finished review with no suggestions, i can check MODX 3 behavior with non-standart ports. Now waiting you response, thx |
The cla-bot stuff isn't working any longer for us, and it should have just directed you to sign on modx.com anyway. Very odd. But I have confirmed now via our internal systems.
See my review comment… |
afe6b68
to
c2d2460
Compare
c2d2460
to
c358fb5
Compare
c358fb5
to
4564d26
Compare
Fixed In default config, setup process and setup wizard. This is port from 2.x branch, all context here: #16455
Fixed In default config, setup process and setup wizard. This is port from 2.x branch, all context here: #16455
What does it do?
I changed logic of modx working with non-standard ports because old logic in some cases works not correct: port :44333 MODX cut ":443" and "33" part breaks the links adresses. See #16428 for details.
Relying on here this and this I suggest using the answers in stackoverflow to check the port not
$_SERVER['SERVER_PORT']
butparse_url($_SERVER['HTTP_HOST'], PHP_URL_PORT)
because it works more reliably and correctly, as can be seen from my tests.Why is it needed?
Currently, when using a non-standard port for https (any one other than 443) MODX modifies request URL with mistakes, and redirect users's browser to wrong url.
See my explaination on awesome handmade infographic :) image:
How to test
I have prepared a test script:
See code: test_modx_working_with_http_ports.php
with a test and comparison of values, as well as speed tests in relation to the replacement of string processing functions (and new logic even a little faster)
Related issue(s)/PR(s)
Resolves #16428 and this hand crutch in MODX Docker project