Css and Javascript links being served on http

am receiving the error below in my browser console, am running a laravel 10 app with docker awis-beta-production.up.railway.app/:14 Mixed Content: The page at 'https://awis-beta-production.up.railway.app/' was loaded over HTTPS, but requested an insecure script 'http://awis-beta-production.up.railway.app/build/assets/app-uKLOvLP4.js'. This request has been blocked; the content must be served over HTTPS.
15 Replies
Percy
Percy8mo ago
Project ID: N/A
maddsua
maddsua8mo ago
I'd suspect it's an issue with the app itself. It's likely that there are hardcoded http links somewhere in the code. If that's the case, it's safe to replace them with relative ones
cloudkasalu
cloudkasalu8mo ago
vite is handling the links @vite(['resources/css/app.css', 'resources/js/app.js'])
maddsua
maddsua8mo ago
Could you check what are the links actually look like in html? You can also see them from devtools network tab
maddsua
maddsua8mo ago
yeah, that is not correct. these links should either be relative to root or use https protocol. does your vite config have site name configured? I don't think that it can pick up site name by default, so it mush be specified somewhere
cloudkasalu
cloudkasalu8mo ago
am using the default env value generated by Laravel,
maddsua
maddsua8mo ago
it's safe to use relative paths like so: /build/assets/app-XZ0t4kG4.css assuming that everything is loaded from the same domain name
cloudkasalu
cloudkasalu8mo ago
it looks like this PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_HOST= PUSHER_PORT=443 PUSHER_SCHEME=https PUSHER_APP_CLUSTER=mt1 VITE_APP_NAME="${APP_NAME}" VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" VITE_PUSHER_HOST="${PUSHER_HOST}" VITE_PUSHER_PORT="${PUSHER_PORT}" VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" i can't change that because it is being dynamically created on build
maddsua
maddsua8mo ago
oh I see is $PUSHER_SCHEME set as a static variable or does the app generate it?
cloudkasalu
cloudkasalu8mo ago
these env configs are generated by laravel have also tried removing the env configs provided above from my railway and the issue still persists
maddsua
maddsua8mo ago
interestingly enough, I don't see any errors in my console when I open the link railway juts upgrades connection to https but I'm using Firefox, it might be different in chrome you can try setting this environment variable: ASSET_URL=https://awis-beta-production.up.railway.app found this on stackoverflow tbh
maddsua
maddsua8mo ago
No description
cloudkasalu
cloudkasalu8mo ago
thank you. it seems the issue was not setting the asset url
maddsua
maddsua8mo ago
don't forget to change it when you go to production though
Want results from more Discord servers?
Add your server