insecure XHR mixed content CORS error #11216
Unanswered
clifmo
asked this question in
Troubleshooting
Replies: 2 comments 2 replies
-
If you're using a proxy, you'll need to configure "trusted proxies" in order for the HTTPS stuff to work properly: https://laravel.com/docs/master/requests#configuring-trusted-proxies |
Beta Was this translation helpful? Give feedback.
1 reply
-
It appears I have resolved this by forcing HTTPS in Laravel. AppServiceProvider.php public function boot(): void
{
if(env('FORCE_HTTPS',false)===true) {
URL::forceScheme('https');
}
} .env
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Bug description
I installed a new site using the Statamic CLI to test a solo site and decided to deploy to my home server behind a reverse proxy. I updated .env APP_URL to the secure URL and brought up the site. The frontend works fine, and control panel mostly works but content is partially loading due to insecure/mixed content. Checking network tabs shows Axios XHR requests sent to the site URL but over HTTP.
Is there some build command I should run after updating APP_URL? I've run every artisan command I can think of. Naturally my thought is to use a middlware but I just noticed there's no
Kernel.php
in this site. Should I be adding statamic to an existing Laravel installation?This seems like a very simple thing I'm missing. If I paste and navigate directly to these HTTP URLs they properly redirect and the content is rendered. It's just CORS that's failing. How can we disable or configure CORS in a statamic site? Are we expected to do this on the web server? What's going on?
How to reproduce
Use ngrok to simplify and illustrate the behavior:
Install a new Statamic site, login to cp, do stuff. It works.
Install ngrok and serve
brew install ngrok
php artisan serve
ngrok http 8000
Update
.env
APP_URL to public HTTPS endpoint.Navigate to HTTPS endpoint see everything is loading via HTTP.
Logs
Environment
Installation
Starter Kit using via CLI
Additional details
No response
Beta Was this translation helpful? Give feedback.
All reactions