Closed zedle closed 8 months ago
Note I am using the .Lite variant
Hi @zedle it looks correct. I just tested with curl -v http://localhost:8080
, and also Chrome, against a change I made to the Test.Default
project to implement your code. With normal Watson webserver, it worked great. But yes, you're right the .Lite
variant doesn't work the same. It appears there are two differences: 1) the status description is different, and 2) the location header somehow doesn't make it to the output.
WatsonWebserver output (curl):
C:\Users\joelc>curl http://localhost:8080/foo -v
* Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET /foo HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Cache-Control: no-cache
< Content-Length: 0
< Location: https://www.google.com
< Server: Microsoft-HTTPAPI/2.0
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: OPTIONS, HEAD, GET, PUT, POST, DELETE, PATCH
< Access-Control-Allow-Headers: *
< Access-Control-Expose-Headers:
< Accept: */*
< Accept-Language: en-US, en
< Accept-Charset: ISO-8859-1, utf-8
< Host: localhost:8000
< Date: Fri, 12 Jan 2024 14:36:52 GMT
< Connection: close
<
* Closing connection
WatsonWebserver.Lite output (curl):
C:\Users\joelc>curl http://localhost:8080/foo -v
* Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET /foo HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Content-Length: 0
< Date: Fri, 12 Jan 2024 14:38:15 GMT
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: OPTIONS, HEAD, GET, PUT, POST, DELETE, PATCH
< Access-Control-Allow-Headers: *
< Access-Control-Expose-Headers:
< Accept: */*
< Accept-Language: en-US, en
< Accept-Charset: ISO-8859-1, utf-8
< Cache-Control: no-cache
< Connection: close
< Host: localhost:8000
<
* Closing connection
I will look into this ASAP. Thanks for letting me know.
Hi @zedle I just published v6.1.6 to NuGet to fix this. Thanks for letting me know about the issue! Please re-open if this doesn't solve it for you.
Also I amended the Test.Default
project to add a pre-auth static route for /redirect
which will provide a status 302 and redirect to https://github.com/dotnet/watsonwebserver
.
Works great now, thank you for the quick fix @jchristn !
I'm trying to setup a 302 redirect from a route. I set the Location header and the status code in the ctx.Response object but the Location header never comes through.
What am I doing wrong here?