laravel-saml2
laravel-saml2 copied to clipboard
Can this work via Valet and ngrok?
I have this package working when it runs on a publicly available server. My next step is to try and get it working in my local dev environment. I am easily able to run valet share
and visit my Laravel app via the ngrok URL provided. However, when I use the exact same config from my production site (the one that is currently working and using the laravel-saml2 package successfully), it appears that my metadata does not come out properly. Specifically, the entityID is using http instead of https.
Has anyone gotten this package to work in a local dev environment? I'd love to continue developing locally rather than develop on a publicly accessible server.
I'm currently using this package for login using valet in a local app, the integration was pretty smooth. You can configure the entityID I believe in saml2_settings to use an env variable
I think I am close. What's interesting now is that when I visit the /saml2/
There are two interesting data points here, that maybe someone can see and know what is going on:
When using Valet locally, and I go to https://
When hosting the site out via ngrok and hitting the ngrok URL in a browser, such as https://123abc.ngrok.io/saml2/
This is the same folder on my machine, I'm just accessing it differently (one locally via Valet using the .test URL, and the other via "valet share" command and then using the ngrok URL given to me.
If you're serving on port 80 from your web server, Laravel's URL generator doesn't know to generate HTTPS URLs. It has no way of knowing that you're then proxying it through HTTPS later on (ngrok).
Add URL::forceScheme('https')
in AppServiceProvider::boot()
and that will tell Laravel to always generate https:// URLs.