dimanche 12 juin 2022

Laravel force http to https redirect but caused "too many redirects"

I have a Saas product which allows my end-user to bind their own domain to manage their products but I encountered an issue when I try to redirect those requests that is originally not requested by "http" to "https", the site will return "too many request redirection". Meanwhile, I do not want to configure port 443 into my nginx configuration as some of scenario, some of the request path might not need to neccessary to have "https". If I configured the force redirection in nginx which means all the request must served under "https" which might leads all of the request path is served via "https" but what I want to achieve is only some of the request path served under https only.

Below is the code that used to achieve the force redirection from http to https

 if (!$request->secure()) {
            return redirect()->secure($request->path());
        }


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire