mcamara / laravel-localization

Easy localization for Laravel
MIT License
3.38k stars 514 forks source link

Middleware\LocaleSessionRedirect can't handle request url from proxy server , cause https to http #765

Open spawnash opened 3 years ago

spawnash commented 3 years ago

Describe the bug i'm using reverse proxy server to handle ssl and load balance this middleware Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect will handle the url with locale prefix, but at line:51 it will parse url from https to http , i guess the reason is this func parse url from load balance request url not client request url

To Reproduce Steps to reproduce the behavior:

  1. i'm using valet share to reproduce
  2. visit a route without locale prefix
  3. die dump the handled url($redirection) which middleware dose
  4. See error image

image

Expected behavior return correct url

More info:

dsqwared5 commented 2 years ago

Describe the bug i'm using reverse proxy server to handle ssl and load balance this middleware Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect will handle the url with locale prefix, but at line:51 it will parse url from https to http , i guess the reason is this func parse url from load balance request url not client request url ... hi, did you fixed it? I have the same issue

tominal commented 2 months ago

Oh wow this is a significantly older issue and I'm encountering it in a multi-tenancy setup in 2024.

This will always occur when a load balancer sends traffic in HTTP instead of HTTPS. I'm not sure what the fix here would be beyond adding a new flag to this repository's config file that forces HTTPS all the time. Actually, if we configure our ALB to forward traffic to an EC2 using HTTPS, then that should take care of this issue.