Hello everyone,
I have a Laravel application with Inertia.js and Vue that I deployed on DigitalOcean Managed App. The deployment went smoothly, but when I navigate between the client-side rendered pages, I get a mixed content error. The error message says "Mixed Content:
The page at 'https://docspot.app/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://docspot.app/login'. This request has been blocked; the content must be served over HTTPS."
I have checked all the configurations in my .env file, and everything includes the app URL with https. I’m not sure what’s causing this error, and I would appreciate any help or guidance on how to resolve it.
Thank you in advance!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey @56da9fe2b90740cc977f19f9bc88e3,
The mixed content error you’re encountering is due to a client-side request being made over HTTP instead of HTTPS.
There are a couple of things you’ll need to check/do to reslove this.
APP_URL in your .env file is set to use https://:- APP_URL=https://docspot.app
In your Inertia.js and Vue.js code, verify that all URLs are generated using Laravel helper functions, such as route() or url(). These helpers will ensure that the URLs are created with the correct scheme, as defined in your .env file.
If you’re using Axios for handling AJAX requests in your Vue.js components, make sure that the baseURL for Axios is correctly set. You can do this in your main.js or a separate Axios configuration file:
- import axios from 'axios';
-
- axios.defaults.baseURL = process.env.MIX_APP_URL || 'http://localhost:8000';
Then, ensure that you have a corresponding variable in your .env file:
- MIX_APP_URL=https://docspot.app
If the issue persists, carefully review your client-side code for any hardcoded URLs with an http:// scheme and update them accordingly.
I had the same problem, this worked for me: https://stackoverflow.com/questions/74990591/laravel-deployed-with-digitalocean-app-http-issue
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.