第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 Kubernetes 部署并通過 Ingress 連接后 SSE 損壞

使用 Kubernetes 部署并通過 Ingress 連接后 SSE 損壞

Go
UYOU 2023-07-31 15:57:11
我有一個使用 EventStream 的 ReactJS 客戶端和一個實現(xiàn) SSE 的 golang 后端。當我將瀏覽器連接到在 localhost 上運行的后端時,以及當我的后端在帶有端口轉發(fā)的 k8s 上運行時,一切似乎都正常。一旦我使用主機名創(chuàng)建入口(這樣我就不必一直進行端口轉發(fā)),SSE 就停止工作。我仍然看到客戶端發(fā)送請求,并且該請求被后端接收并注冊。但是,當發(fā)送事件時,它永遠不會到達我的 ReactJS 應用程序。在我的 ReactJS 應用程序中:export default class CustomersTable extends Component {  constructor(props) {    super(props)    this.eventSource = new EventSource('/v1/events')  }  updateCustomerState(e) {    let event = JSON.parse(e.data)    switch (event.event_type) {      case 'customerStateUpdate':        let newData = this.state.customers.map(item => {          if (item.name === event.customer_name) {            item.k8sState = event.customer_state          }          return item        })        this.setState(Object.assign({}, { customers: newData }))        break      case 'contentUpdate':        this.reload()        break      default:        break    }  }  componentDidMount() {    this.setState({ isLoading: true })    ReactModal.setAppElement('body')    this.reload()    this.eventSource.onmessage = e => this.updateCustomerState(e)  }  componentWillUnmount() {    this.eventSource.close()  }...
查看完整描述

1 回答

?
慕標5832272

TA貢獻1966條經(jīng)驗 獲得超4個贊

我在 Nginx Ingress 上使用了我的 SSE 應用程序:

   annotations:
    nginx.ingress.kubernetes.io/proxy-read-timeout: "21600"
    nginx.ingress.kubernetes.io/eventsource: "true"


查看完整回答
反對 回復 2023-07-31
  • 1 回答
  • 0 關注
  • 360 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號