Stack Overflow Asked on December 22, 2021
I have an end point in a Spring Boot application that produces Text Event Stream as output.
@GetMapping(value = "/stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<EventMessage<?>> findStream() {
return eventStream.log().share();
}
When running project jar locally this endpoint works fine but when I deploy this in kubernetes on a digital ocean droplet, this endpoint does not seem to respond.
I have debugged a bit, it seems when hitting the end point from browser the page keeps on loading with no data. But the request is sent as I have logs and also when a new event is published the logs appear. But not result is appearing in browser
The service is running in a single node microk8s environment deployed as NodePort
UPDATE:
It seems the output stream is blocked by the node’s firewall as i can curl the endpoint while inside node. Still not sure how it is getting blocked.
This has nothing to do with your Cloud Provider - Digital Ocean.
The Block malicious downloads
feature prevents the HTML5 feature Server Sent Events (SSE) from working properly. As the SSE works over HTTP using text/event-stream as content-type it looks like a never-ending download
. The scanner holds the SSE message until the channel breaks for some reason and hands over the message to the browser.
Just like you are able to cURL the endpoint while inside node, you can cURL from outside the K8S environment too.
One workaround (as suggested here) is to add a website authorization for the source IP of the stream.
There is also a similar github issue which talks about breaking of Http streaming.
Answered by Abhinaba Chakraborty on December 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP