Angular 7 PWA + Azure Functions Gateway Timeout 504 only with Https











up vote
1
down vote

favorite












So the title pretty much says it all!



I have an Angular 7 app compiled as PWA my package.json is below. My backend api is written in AzureFunctions V2.



"dependencies": {
"@angular-devkit/core": "^7.0.5",
"@angular/animations": "^7.0.3",
"@angular/cdk": "^7.0.3",
"@angular/common": "^7.0.3",
"@angular/compiler": "^7.0.3",
"@angular/core": "^7.0.3",
"@angular/flex-layout": "^7.0.0-beta.19",
"@angular/forms": "^7.0.3",
"@angular/http": "^7.0.3",
"@angular/material": "^7.0.3",
"@angular/platform-browser": "^7.0.3",
"@angular/platform-browser-dynamic": "^7.0.3",
"@angular/platform-server": "^7.0.3",
"@angular/pwa": "^0.10.5",
"@angular/router": "^7.0.3",
"@angular/service-worker": "^7.0.3",
"@types/date-fns": "^2.6.0",
"angular-calendar": "^0.26.4",
"chartist": "^0.11.0",
"core-js": "^2.5.7",
"rxjs": "^6.3.3",
"rxjs-compat": "^6.3.3",
"zone.js": "^0.8.26"
},


The problem I am having is that when I set my api endpoint to use https I get 504 Gateway Timeout errors. I know the https configuration/functionality is fine as this is all automatically configured by Azure with Azure Functions.



Also all my api requests work fine with Postman over https.



enter image description here



Update - So a bit of a development, if I run this locally without PWA enabled I get the following different ERR_SPDY_PROTOCOL_ERROR



This is debug info in chrome chrome://net-internals/#events



t=9314 [st= 1]        UPLOAD_DATA_STREAM_READ  [dt=0]
--> current_position = 0
t=9314 [st= 1] HTTP2_STREAM_UPDATE_SEND_WINDOW
--> delta = -73
--> stream_id = 3
--> window_size = 1048503
t=9314 [st= 1] -HTTP_TRANSACTION_SEND_REQUEST
t=9314 [st= 1] +HTTP_TRANSACTION_READ_HEADERS [dt=21]
t=9335 [st=22] HTTP2_STREAM_ERROR
--> description = "Server reset stream."
--> net_error = "ERR_SPDY_PROTOCOL_ERROR"
--> stream_id = 3
t=9335 [st=22] -HTTP_TRANSACTION_READ_HEADERS
--> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
t=9335 [st=22] -URL_REQUEST_START_JOB
--> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
t=9335 [st=22] URL_REQUEST_DELEGATE_RESPONSE_STARTED [dt=0]
t=9335 [st=22] -REQUEST_ALIVE
--> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)


Ok so another update 5hrs later! This just gets more and more weird.



I forced in a valid token into my header to see if other endpoints were working once I was logged in. Amazingly everything else worked fine even under https it was just my Https POST /token x-www-form-urlencoded request that didn't work ?!?!? (Http is fine!)



So out of despair I installed FireFox just see if I could get more debug information, which it sort of did. I got this error CORS request did not succeed but with none of the clues as to why that most people get.



This led me to attempting this Azure Functions Access-Control-Allow-Credentials with CORS



This didn't help also. I wasn't convinced it would work as all my CORS settings were fine I proved this by forcing in the token.



I decided to take Angular totally out of the equation by not using the Angular HttpClient using the code below:



 public getToken()
{
let xhr = new XMLHttpRequest();
xhr.open("POST", this.API_URL + '/token', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.onreadystatechange = function() {
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
// save token here
}
};
xhr.send(body);
}


And it just Works!!! WTF ? So I lost a day on this, and I guess that proves that this is related to the Angular HttpClient.



So I'll go with this for now.



If anyone know's why this might be happening or have come across this before it would be appreciated, as I'd rather be consistent and use the HttpClient throughout my app.










share|improve this question




























    up vote
    1
    down vote

    favorite












    So the title pretty much says it all!



    I have an Angular 7 app compiled as PWA my package.json is below. My backend api is written in AzureFunctions V2.



    "dependencies": {
    "@angular-devkit/core": "^7.0.5",
    "@angular/animations": "^7.0.3",
    "@angular/cdk": "^7.0.3",
    "@angular/common": "^7.0.3",
    "@angular/compiler": "^7.0.3",
    "@angular/core": "^7.0.3",
    "@angular/flex-layout": "^7.0.0-beta.19",
    "@angular/forms": "^7.0.3",
    "@angular/http": "^7.0.3",
    "@angular/material": "^7.0.3",
    "@angular/platform-browser": "^7.0.3",
    "@angular/platform-browser-dynamic": "^7.0.3",
    "@angular/platform-server": "^7.0.3",
    "@angular/pwa": "^0.10.5",
    "@angular/router": "^7.0.3",
    "@angular/service-worker": "^7.0.3",
    "@types/date-fns": "^2.6.0",
    "angular-calendar": "^0.26.4",
    "chartist": "^0.11.0",
    "core-js": "^2.5.7",
    "rxjs": "^6.3.3",
    "rxjs-compat": "^6.3.3",
    "zone.js": "^0.8.26"
    },


    The problem I am having is that when I set my api endpoint to use https I get 504 Gateway Timeout errors. I know the https configuration/functionality is fine as this is all automatically configured by Azure with Azure Functions.



    Also all my api requests work fine with Postman over https.



    enter image description here



    Update - So a bit of a development, if I run this locally without PWA enabled I get the following different ERR_SPDY_PROTOCOL_ERROR



    This is debug info in chrome chrome://net-internals/#events



    t=9314 [st= 1]        UPLOAD_DATA_STREAM_READ  [dt=0]
    --> current_position = 0
    t=9314 [st= 1] HTTP2_STREAM_UPDATE_SEND_WINDOW
    --> delta = -73
    --> stream_id = 3
    --> window_size = 1048503
    t=9314 [st= 1] -HTTP_TRANSACTION_SEND_REQUEST
    t=9314 [st= 1] +HTTP_TRANSACTION_READ_HEADERS [dt=21]
    t=9335 [st=22] HTTP2_STREAM_ERROR
    --> description = "Server reset stream."
    --> net_error = "ERR_SPDY_PROTOCOL_ERROR"
    --> stream_id = 3
    t=9335 [st=22] -HTTP_TRANSACTION_READ_HEADERS
    --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
    t=9335 [st=22] -URL_REQUEST_START_JOB
    --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
    t=9335 [st=22] URL_REQUEST_DELEGATE_RESPONSE_STARTED [dt=0]
    t=9335 [st=22] -REQUEST_ALIVE
    --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)


    Ok so another update 5hrs later! This just gets more and more weird.



    I forced in a valid token into my header to see if other endpoints were working once I was logged in. Amazingly everything else worked fine even under https it was just my Https POST /token x-www-form-urlencoded request that didn't work ?!?!? (Http is fine!)



    So out of despair I installed FireFox just see if I could get more debug information, which it sort of did. I got this error CORS request did not succeed but with none of the clues as to why that most people get.



    This led me to attempting this Azure Functions Access-Control-Allow-Credentials with CORS



    This didn't help also. I wasn't convinced it would work as all my CORS settings were fine I proved this by forcing in the token.



    I decided to take Angular totally out of the equation by not using the Angular HttpClient using the code below:



     public getToken()
    {
    let xhr = new XMLHttpRequest();
    xhr.open("POST", this.API_URL + '/token', true);
    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

    xhr.onreadystatechange = function() {
    if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
    // save token here
    }
    };
    xhr.send(body);
    }


    And it just Works!!! WTF ? So I lost a day on this, and I guess that proves that this is related to the Angular HttpClient.



    So I'll go with this for now.



    If anyone know's why this might be happening or have come across this before it would be appreciated, as I'd rather be consistent and use the HttpClient throughout my app.










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      So the title pretty much says it all!



      I have an Angular 7 app compiled as PWA my package.json is below. My backend api is written in AzureFunctions V2.



      "dependencies": {
      "@angular-devkit/core": "^7.0.5",
      "@angular/animations": "^7.0.3",
      "@angular/cdk": "^7.0.3",
      "@angular/common": "^7.0.3",
      "@angular/compiler": "^7.0.3",
      "@angular/core": "^7.0.3",
      "@angular/flex-layout": "^7.0.0-beta.19",
      "@angular/forms": "^7.0.3",
      "@angular/http": "^7.0.3",
      "@angular/material": "^7.0.3",
      "@angular/platform-browser": "^7.0.3",
      "@angular/platform-browser-dynamic": "^7.0.3",
      "@angular/platform-server": "^7.0.3",
      "@angular/pwa": "^0.10.5",
      "@angular/router": "^7.0.3",
      "@angular/service-worker": "^7.0.3",
      "@types/date-fns": "^2.6.0",
      "angular-calendar": "^0.26.4",
      "chartist": "^0.11.0",
      "core-js": "^2.5.7",
      "rxjs": "^6.3.3",
      "rxjs-compat": "^6.3.3",
      "zone.js": "^0.8.26"
      },


      The problem I am having is that when I set my api endpoint to use https I get 504 Gateway Timeout errors. I know the https configuration/functionality is fine as this is all automatically configured by Azure with Azure Functions.



      Also all my api requests work fine with Postman over https.



      enter image description here



      Update - So a bit of a development, if I run this locally without PWA enabled I get the following different ERR_SPDY_PROTOCOL_ERROR



      This is debug info in chrome chrome://net-internals/#events



      t=9314 [st= 1]        UPLOAD_DATA_STREAM_READ  [dt=0]
      --> current_position = 0
      t=9314 [st= 1] HTTP2_STREAM_UPDATE_SEND_WINDOW
      --> delta = -73
      --> stream_id = 3
      --> window_size = 1048503
      t=9314 [st= 1] -HTTP_TRANSACTION_SEND_REQUEST
      t=9314 [st= 1] +HTTP_TRANSACTION_READ_HEADERS [dt=21]
      t=9335 [st=22] HTTP2_STREAM_ERROR
      --> description = "Server reset stream."
      --> net_error = "ERR_SPDY_PROTOCOL_ERROR"
      --> stream_id = 3
      t=9335 [st=22] -HTTP_TRANSACTION_READ_HEADERS
      --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
      t=9335 [st=22] -URL_REQUEST_START_JOB
      --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
      t=9335 [st=22] URL_REQUEST_DELEGATE_RESPONSE_STARTED [dt=0]
      t=9335 [st=22] -REQUEST_ALIVE
      --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)


      Ok so another update 5hrs later! This just gets more and more weird.



      I forced in a valid token into my header to see if other endpoints were working once I was logged in. Amazingly everything else worked fine even under https it was just my Https POST /token x-www-form-urlencoded request that didn't work ?!?!? (Http is fine!)



      So out of despair I installed FireFox just see if I could get more debug information, which it sort of did. I got this error CORS request did not succeed but with none of the clues as to why that most people get.



      This led me to attempting this Azure Functions Access-Control-Allow-Credentials with CORS



      This didn't help also. I wasn't convinced it would work as all my CORS settings were fine I proved this by forcing in the token.



      I decided to take Angular totally out of the equation by not using the Angular HttpClient using the code below:



       public getToken()
      {
      let xhr = new XMLHttpRequest();
      xhr.open("POST", this.API_URL + '/token', true);
      xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

      xhr.onreadystatechange = function() {
      if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
      // save token here
      }
      };
      xhr.send(body);
      }


      And it just Works!!! WTF ? So I lost a day on this, and I guess that proves that this is related to the Angular HttpClient.



      So I'll go with this for now.



      If anyone know's why this might be happening or have come across this before it would be appreciated, as I'd rather be consistent and use the HttpClient throughout my app.










      share|improve this question















      So the title pretty much says it all!



      I have an Angular 7 app compiled as PWA my package.json is below. My backend api is written in AzureFunctions V2.



      "dependencies": {
      "@angular-devkit/core": "^7.0.5",
      "@angular/animations": "^7.0.3",
      "@angular/cdk": "^7.0.3",
      "@angular/common": "^7.0.3",
      "@angular/compiler": "^7.0.3",
      "@angular/core": "^7.0.3",
      "@angular/flex-layout": "^7.0.0-beta.19",
      "@angular/forms": "^7.0.3",
      "@angular/http": "^7.0.3",
      "@angular/material": "^7.0.3",
      "@angular/platform-browser": "^7.0.3",
      "@angular/platform-browser-dynamic": "^7.0.3",
      "@angular/platform-server": "^7.0.3",
      "@angular/pwa": "^0.10.5",
      "@angular/router": "^7.0.3",
      "@angular/service-worker": "^7.0.3",
      "@types/date-fns": "^2.6.0",
      "angular-calendar": "^0.26.4",
      "chartist": "^0.11.0",
      "core-js": "^2.5.7",
      "rxjs": "^6.3.3",
      "rxjs-compat": "^6.3.3",
      "zone.js": "^0.8.26"
      },


      The problem I am having is that when I set my api endpoint to use https I get 504 Gateway Timeout errors. I know the https configuration/functionality is fine as this is all automatically configured by Azure with Azure Functions.



      Also all my api requests work fine with Postman over https.



      enter image description here



      Update - So a bit of a development, if I run this locally without PWA enabled I get the following different ERR_SPDY_PROTOCOL_ERROR



      This is debug info in chrome chrome://net-internals/#events



      t=9314 [st= 1]        UPLOAD_DATA_STREAM_READ  [dt=0]
      --> current_position = 0
      t=9314 [st= 1] HTTP2_STREAM_UPDATE_SEND_WINDOW
      --> delta = -73
      --> stream_id = 3
      --> window_size = 1048503
      t=9314 [st= 1] -HTTP_TRANSACTION_SEND_REQUEST
      t=9314 [st= 1] +HTTP_TRANSACTION_READ_HEADERS [dt=21]
      t=9335 [st=22] HTTP2_STREAM_ERROR
      --> description = "Server reset stream."
      --> net_error = "ERR_SPDY_PROTOCOL_ERROR"
      --> stream_id = 3
      t=9335 [st=22] -HTTP_TRANSACTION_READ_HEADERS
      --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
      t=9335 [st=22] -URL_REQUEST_START_JOB
      --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)
      t=9335 [st=22] URL_REQUEST_DELEGATE_RESPONSE_STARTED [dt=0]
      t=9335 [st=22] -REQUEST_ALIVE
      --> net_error = -337 (ERR_SPDY_PROTOCOL_ERROR)


      Ok so another update 5hrs later! This just gets more and more weird.



      I forced in a valid token into my header to see if other endpoints were working once I was logged in. Amazingly everything else worked fine even under https it was just my Https POST /token x-www-form-urlencoded request that didn't work ?!?!? (Http is fine!)



      So out of despair I installed FireFox just see if I could get more debug information, which it sort of did. I got this error CORS request did not succeed but with none of the clues as to why that most people get.



      This led me to attempting this Azure Functions Access-Control-Allow-Credentials with CORS



      This didn't help also. I wasn't convinced it would work as all my CORS settings were fine I proved this by forcing in the token.



      I decided to take Angular totally out of the equation by not using the Angular HttpClient using the code below:



       public getToken()
      {
      let xhr = new XMLHttpRequest();
      xhr.open("POST", this.API_URL + '/token', true);
      xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

      xhr.onreadystatechange = function() {
      if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
      // save token here
      }
      };
      xhr.send(body);
      }


      And it just Works!!! WTF ? So I lost a day on this, and I guess that proves that this is related to the Angular HttpClient.



      So I'll go with this for now.



      If anyone know's why this might be happening or have come across this before it would be appreciated, as I'd rather be consistent and use the HttpClient throughout my app.







      azure-functions angular-httpclient angular7 angular-pwa






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 20:20

























      asked Nov 11 at 13:47









      Lenny D

      20429




      20429





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249379%2fangular-7-pwa-azure-functions-gateway-timeout-504-only-with-https%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249379%2fangular-7-pwa-azure-functions-gateway-timeout-504-only-with-https%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine