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

Replacing hardcoded protocol in mix helper #18943

Merged
merged 4 commits into from
Apr 26, 2017
Merged

Replacing hardcoded protocol in mix helper #18943

merged 4 commits into from
Apr 26, 2017

Conversation

OwenMelbz
Copy link
Contributor

This does not solve "the whole problem" however currently the mix helper hardcodes the port and protocol.

When using SSL on your development environment browsers refuse to load the assets served by mix when using HMR over http

This change makes sure it uses the correct protocol.

Although it doesn't solve the issue of users not having SSL on "localhost"

This does not solve "the whole problem" however currently the mix helper hardcodes the port and protocol.

When using SSL on your development environment browsers refuse to load the assets served by mix when using HMR over http

This change makes sure it uses the correct protocol.

Although it doesn't solve the issue of users not having SSL on "localhost"
return new HtmlString("http://localhost:8080{$path}");
$hotProtocol = request()->secure() ? 'https' : 'http';

return new HtmlString("{$hotProtocol}://localhost:8080{$path}");
Copy link
Member

Choose a reason for hiding this comment

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

You can simply use a protocol-relative URL:

return new HtmlString("//localhost:8080{$path}");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha sure, that also works, guess I definitely over engineered that :D

@taylorotwell taylorotwell merged commit 9100b42 into laravel:5.4 Apr 26, 2017
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.

3 participants