location /testsms {
    proxy_hide_header "Access-Control-Allow-Origin";
    proxy_hide_header "Access-Control-Allow-Credentials";
    proxy_hide_header "Access-Control-Allow-Headers";

    add_header Access-Control-Allow-Origin "$http_origin";
    add_header Access-Control-Allow-Credentials "true";

    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Real-Addr $remote_addr:$remote_port;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_pass http://custom_sms_gw;

    proxy_read_timeout 86400s;

    proxy_http_version 1.1;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
}
