AKS URL rewrite makes a 404 as it ignores the URL naming convention
When I access dev.dev.com/merchant, an Angular app, it will show a blank page. Checking console, it shows
GET https://dev.dev.com/runtime.js net::ERR_ABORTED 404
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: dev-ingress
namespace: dev
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
tls:
- hosts:
- dev.dev.com
secretName: ssl
rules:
- host: dev.dev.com
http:
paths:
- backend:
serviceName: dashboard
servicePort: 80
path: /merchant(/|$)(.*)
I'm expecting:
dev.dev.com/merchant/runtime.js and that the whole application runs fine with /merchant in the url.
Accessing the service via IP address directly is fine. Now sure what I am missing.
For your issue, when you use a custom domain, then you need to use not only an nginx ingress controller but also need an HTTP route. If not, it shows the error 404.
If you just to do the test for a domain name, you can use the HTTP application routing that Azure provides, the steps in HTTP application routing. You can also create a subdomain for the Azure DNS with the public IP, and you can follow the steps in Create an HTTPS ingress controller on Azure Kubernetes Service (AKS).