user9874638
user9874638

Reputation:

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

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.

Upvotes: 0

Views: 336

Answers (3)

user9874638
user9874638

Reputation:

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

Upvotes: 0

user9874638
user9874638

Reputation:

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

Upvotes: 1

Ahmed Nasr
Ahmed Nasr

Reputation: 119

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

Upvotes: 0

Related Questions