PDA

View Full Version : REST local v server and reporting errors



Clive Richmond
17-Feb-2021, 11:02 PM
In the last couple of weeks I noticed a difference in running our REST APIs locally, a Windows 10 machine, and our demonstration server, a Windows Server 2019.

On the server when an error is triggered, 40X or 50X, the response returned wasn't the one we had crafted or generated by Mike Peat's REST framework. It was something like this (note this is the short version):


<body>
<divid="header">
<h1>Server Error</h1>
</div>
<divid="content">
<divclass="content-container">
<fieldset>
<h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
<h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
</fieldset>
</div>
</div>
</body>


Instead of:


{
"Unauthorized": "Session key not known (reload page to recreate session)."
}




I suspect the problem on the server has always been there since my testing is done on the my local machine.

Anyway, should anyone come across a similar issue I was alerted to this post (https://stackoverflow.com/questions/31040671/what-does-existingresponse-passthrough-mean-in-iis). Configuring the website's existingResponse on the server from Auto to PassThrough resolved the issue.

14330

Hans van de Laar
18-Feb-2021, 03:01 AM
Good to know, thanks Clive.