Skip to content

Text/Event Stream response doesnt work through Nginx #102659

Answered by yusofy
spyhunter1280 asked this question in Actions
Discussion options

You must be logged in to vote

Figured it out with the help of colleagues . Running it in Kubernetes, I translated it back to nginx config:

location / {
    if ($request_method = 'OPTIONS') {
        add_header 'Content-Type' 'text/plain charset=UTF-8';
        add_header 'Content-Length' 0;
        return 204;
    }

    proxy_buffering off;
    proxy_http_version 1.1;
    proxy_max_temp_file_size 0;

    # Cors Preflight methods needs additional options and different Return Code
    chunked_transfer_encoding on;
    add_header 'Access-Control-Allow-Origin' $http_origin;
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS';
   …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@spyhunter1280
Comment options

@yusofy
Comment options

Answer selected by spyhunter1280
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
2 participants