Skip to content

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