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

improve use of protocol #11635

Merged
merged 2 commits into from Dec 12, 2018

Conversation

Projects
None yet
5 participants
@MathiasReker
Copy link
Contributor

MathiasReker commented Dec 6, 2018

Questions Answers
Branch? develop
Description? prevent redirect in some cases.
Type? improvement
Category? CO
BC breaks? no
Deprecations? no
Fixed ticket? /
How to test? /

This change is Reviewable

Show resolved Hide resolved classes/shop/Shop.php Outdated
@mickaelandrieu

This comment has been minimized.

Copy link
Contributor

mickaelandrieu commented Dec 7, 2018

Hello @MathiasReker,

can you explain how we can test it, please?

Mickaël

@MathiasReker

This comment has been minimized.

Copy link
Contributor

MathiasReker commented Dec 7, 2018

@mickaelandrieu I don't know where is header is set, sorry. I just made the PR from a theoretic point of view.

@mickaelandrieu

This comment has been minimized.

Copy link
Contributor

mickaelandrieu commented Dec 10, 2018

ping @Quetzacoalt91 any chance to set up a shop in https with this pull request?

Before: headers says HTTP
After: headers says HTTPS

When a product doesn't exist and/or when you configure a redirection for a product.

@@ -369,7 +369,7 @@ public static function initialize()
$redirect_header = ($redirect_type == 1 ? 'Found' : 'Moved Permanently');
header('HTTP/1.0 ' . $redirect_code . ' ' . $redirect_header);
header('Cache-Control: no-cache');
header('Location: http://' . $url);
header('Location: ' . Tools::getShopProtocol() . $url);

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Dec 11, 2018

Member

This one covers a wrong domain.

For instance, if you installed your shop locally with the domain 127.0.0.1, this code will be called by reaching your website from http(s)://localhost.

@@ -441,7 +441,7 @@ public static function initialize()
$redirect_code = ($redirect_type == 1 ? '302' : '301');
$redirect_header = ($redirect_type == 1 ? 'Found' : 'Moved Permanently');
header('HTTP/1.0 ' . $redirect_code . ' ' . $redirect_header);
header('Location: http://' . $url);
header('Location: ' . Tools::getShopProtocol() . $url);

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Dec 11, 2018

Member

To trigger this code, call a shop with URL rewriting enabled through a URL generated without GET parameters.

From instance: Calling http://<shop_domain>/index.php?idPayment=1337&fc=module&module=cheque&controller=validation&id_lang=1 should trigger this code to redirect you to http://<shop_domain>/en/module/cheque/validation?idPayment=1337

@Quetzacoalt91

This comment has been minimized.

Copy link
Member

Quetzacoalt91 commented Dec 11, 2018

If the QA is unable to create its shop with SSL, I can have one something for them.

@marionf marionf added QA ✔️ and removed waiting for QA labels Dec 12, 2018

@Quetzacoalt91 Quetzacoalt91 merged commit 30d2694 into PrestaShop:develop Dec 12, 2018

2 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Quetzacoalt91

This comment has been minimized.

Copy link
Member

Quetzacoalt91 commented Dec 12, 2018

Thank you @MathiasReker

@Quetzacoalt91 Quetzacoalt91 added this to the 1.7.6.0 milestone Dec 12, 2018

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