After adding `rewrite-target: /`, the app home page loads but CSS and JS return 404.
IntermediateTroubleshootingServices, DNS, Ingress and NetworkPolicy
Answer
Likely causes → A path /shop with rewrite-target: / rewrites every request to /, so /shop/static/app.css also becomes /. Or the app emits absolute links (/static/...) that skip the /shop prefix.
Diagnose →
kubectl get ingress shop -o yaml | yq '.metadata.annotations, .spec.rules'
curl -s https://example.com/shop/ | grep -Eo '(src|href)="[^"]+"' | head
Fix → Use capture groups so the remainder of the path is kept:
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
rules:
- http:
paths:
- path: /shop(/|$)(.*)
pathType: ImplementationSpecific
backend: {service: {name: shop, port: {number: 80}}}
And configure the app's base path so it emits /shop/static/....
Prevent → Prefer host-based routing per app over path prefixes when apps are not prefix-aware.
More on Services, DNS, Ingress and NetworkPolicy
`curl http://orders.shop.svc.cluster.local` hangs, and `kubectl get endpointslices -l kubernetes.io/service-name=orders` shows `ENDPOINTS <unset>`.BeginnerEndpoints exist, but `curl orders:80` returns `Connection refused`.BeginnerA Service works when you curl the Pod IP but times out on the ClusterIP from every node.IntermediateInside a Pod, `nslookup orders` returns `;; connection timed out; no servers could be reached`.BeginnerCoreDNS Pods are in CrashLoopBackOff with `[FATAL] plugin/loop: Loop (127.0.0.1:41823 -> :53) detected for zone "."`.IntermediateCalls to `api.stripe.com` from Pods are slow, and CoreDNS logs show `api.stripe.com.payments.svc.cluster.local`, `api.stripe.com.svc.cluster.local` … all `NXDOMAIN`.Intermediate