简体   繁体   中英

Running angularjs 1.6.x on azure node.js webapp, long url causes a 404 server error

I currently have two azure web apps deployed running on a node.js express server using angularjs (1.6.x) for my MVC (ui-router as well). My first web app links directly to the other, passing an access token in the query params for authentication. This all works fine while running from my localhost; however, once deployed to Azure I am receiving a 404 not found error. The URL is roughly 1700 characters long.

The access token is safe for URLs, as are my other two query params (which are much shorter). Surprisingly (to me), if I shorten the value of my "token" parameter my angular application loads no problem when on Azure.

Is there some setting in Azure or iisnode.yml that can help with this problem? It seems like it's the length of my URL that is causing the issue.

Azure uses IIS host your web app. And the <requestLimits> element specifies limits on HTTP requests that are processed by IIS. So to fix your issue, you can specify the maximum length of the query string, in bytes. The default value is 2048 .

Please add the following to your web.config :

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxQueryString="32768"/>
    </requestFiltering>
  </security>
</system.webServer>

More detailed information, you can refer to https://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM