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

[11.x] Add URL::forceHttps() to enforce HTTPS scheme for URLs #53381

Merged
merged 2 commits into from
Nov 3, 2024

Conversation

dasundev
Copy link
Contributor

@dasundev dasundev commented Nov 2, 2024

This PR introduces the URL::forceHttps() method, which simplifies enforcing the HTTPS scheme for URLs without requiring the scheme name.

A useful use case is to enforce HTTPS only in the production environment. You can achieve this with the following code:

URL::forceHttps(
    $this->app->isProduction()
);

@dasundev dasundev changed the title [11.x] Add forceHttps() to enforce HTTPS scheme for URLs. [11.x] Add forceHttps() to enforce HTTPS scheme for URLs Nov 2, 2024
@dasundev dasundev changed the title [11.x] Add forceHttps() to enforce HTTPS scheme for URLs [11.x] Add URL::forceHttps() to enforce HTTPS scheme for URLs Nov 3, 2024
@taylorotwell taylorotwell merged commit cdf07b6 into laravel:11.x Nov 3, 2024
33 checks passed
@dasundev dasundev deleted the force-https branch November 4, 2024 04:58
@ahinkle
Copy link
Contributor

ahinkle commented Nov 21, 2024

@dasundev Would you care to submit a PR to docs? 🙂

@dasundev
Copy link
Contributor Author

@ahinkle I couldn't do that. Maybe you can help me with that.

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