I would like to set up my project in k8s environment. My app consists of frontend(react), api(node.js) and db(mongoDB). What I can do now is setup frontend so I can see mainpage, also I can request backend with GET method (both from postman and browser). But for reason I cannot establish proper connection with API through POST, ie. I can see that the endpoint is reached but the payload is empty. In non-k8s environment it works well so it needs to be connected to some k8s setup.
Client deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: panel-admin-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: panel-admin
  template:
    metadata:
      labels:
        component: panel-admin
    spec:
      containers:
        - name: panel-admin
          image: XXX
          ports:
            - containerPort: 3000
          env:
            - name: API_BASE_URL
              value: panel-admin-server-service
      imagePullSecrets:
        - name: gcr-json-keyClient service:
apiVersion: v1
kind: Service
metadata:
  name: panel-admin-service
spec:
  type: ClusterIP
  selector:
    component: panel-admin
  ports:
    - port: 3000
      targetPort: 3000Ingress for both api and frontend routes:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
    - http:
        paths:
          - path: /.*
            backend:
              serviceName: panel-admin-service
              servicePort: 3000
          - path: /api/.* // here goes my GET request and it works well
            backend:
              serviceName: panel-admin-server-service
              servicePort: 3001
          - path: /auth/.* // here goes my POST request, ie. it starts with auth
            backend:
              serviceName: panel-admin-server-service 
              servicePort: 3001Server deployment file:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: panel-admin-api-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: panel-admin-api
  template:
    metadata:
      labels:
        component: panel-admin-api
    spec:
      containers:
        - name: panel-admin-api
          image: XXX
          ports:
            - containerPort: 3001
          env:
            - name: MONGO_URL
              value: mongodb://panel-admin-mongo-cluster-ip-service/mongodb
      imagePullSecrets:
        - name: gcr-json-keyServer service:
apiVersion: v1
kind: Service
metadata:
  name: panel-admin-server-service
spec:
  type: ClusterIP
  selector:
    component: panel-admin-api
  ports:
    - port: 3001
      targetPort: 3001So from the browser I'm getting 502 Bad Gateway error, from Postman it reaches the endpoint but the POST payload is empty. What am I missing here?
Try changing the URL from http://example.com/api to https://example.com/api if you are using HTTPS
POST requests doesn't redirect to https automatically by default refer Redirecting HTTP POST requests to HTTPS POST requests