Using NGINX on Kubernetes tries to load the assets with private IP rather than the domain

2/13/2019

So i'm using Laravel with Kubernetes and everything works great, except for the fact that when i access the website, it takes too much to load. I troubleshot it and i found out that some CSS and JS files are loaded using the private ip (the one that starts with 10: 10.244.xx.xx)

I have no idea what's going on. Is it some kind of NGINX setting that messes it up? I am using the default NGINX Ingress for the cluster and i repeat: everything works great, except with this particular thing.

Edit: It seems like the route:cache command messes everything. I don't know why.

--
kubernetes
laravel
networking
nginx

3 Answers

2/22/2019

So, i found it. It seems like i had to run route:cache between config:cache and view:cache on each pod deployment.

--
Source: StackOverflow

2/13/2019

make sure you got the domain right in .env file, in the root folder of your Application run:

sudo nano .env

find APP_URL parameter and configure it right, then run:

php artisan config:cache
-- Ahmed Nasr
Source: StackOverflow

2/13/2019

Never use secure_asset() over asset() unless you know what it can do. I had to replace all my secure_asset() with asset()

--
Source: StackOverflow