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

Website serves content over HTTP not HTTPS #3

Closed
Kyle-Jeynes opened this issue May 1, 2021 · 1 comment
Closed

Website serves content over HTTP not HTTPS #3

Kyle-Jeynes opened this issue May 1, 2021 · 1 comment

Comments

@Kyle-Jeynes
Copy link
Owner

Describe the bug
Because the service is exposed to port 80, Laravel picks up the request as HTTP although all information was passed over HTTPS.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy your Laravel VCS that uses url()

Expected behavior
url()->to('/') should return HTTPS not HTTP.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version 20.04

Additional context
A fix is provided below

@Kyle-Jeynes
Copy link
Owner Author

To fix this issue

Append the following into your app/Providers/AppServiceProvider.php and ensure your laravel/src/.env is in production.

public function register() {
    if (env('APP_ENV') === 'production') {
        $this->app['request']->server->set('HTTPS', true);
    }
}

We'll look into trying to provide a fix via Traefik but the above will work in all cases.

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

No branches or pull requests

1 participant