Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
310 views
in Technique[技术] by (71.8m points)

reactjs - Ingress-nginx Keeps reloading my apps (built in next.js)

When I try to access my app from the browser I get the app working, but it only takes a couple of seconds till my app gets re-rendered, it only loads the previous image I created the first time I was dealing with the project, in other words: when I first initiated the app, my index.js was

const NewPage = () => {
  return <h1> Index </h1>;
};

export default NewPage;

Then I have changed it to that

const NewPage = () => {
  return <h1> New Index </h1>;
};

export default NewPage;

So when I open the app in the browser I see the first case I see only the Index word in the dom, a couple of seconds later it gets re-rendered, and I see New Index. Something is off for sure, so here is my ingress-srv.yaml file:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
  rules:
    - host: ticketing.dev
      http:
        paths:
          - path: /api/users/?(.*)
            backend:
              serviceName: auth-srv
              servicePort: 3000
          - path: /?(.*)
            backend:
              serviceName: client-srv
              servicePort: 3000

and here is my skaffold page;

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: kyrolos/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
    - image: kyrolos/client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '**/*.js'
            dest: .
question from:https://stackoverflow.com/questions/65897932/ingress-nginx-keeps-reloading-my-apps-built-in-next-js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...