dev-tunnels icon indicating copy to clipboard operation
dev-tunnels copied to clipboard

Tunnel is stopped, Get response to my api still Ok (200)

Open Francescolis opened this issue 11 months ago • 1 comments

I'm encountering a strange situation for me : I have developed an api locally. I've activated dev-tunnel in persistence mode. So far so good.

I've connected it to a MAUI mobile application. Then a strange behavior occurs :

(I'm using HttpClient, HttpClientMessage and HttpClientResponse)

The api is stopped

  • When I use the localhost address to call my api, I get an error, which is normal.
  • And when I use the dev-tunnel address when the tunnel is also stopped, I get a 200 response!

How is this possible?

2024-03-17 13_30_37-Kamersoft Net - Microsoft Visual Studio Preview

Francescolis avatar Mar 17 '24 12:03 Francescolis

If the tunnel is not started and you get a OK 200, I suspect that response is coming from elsewhere. Can you share the uri for that request (redacting any sensitive info)? Also, can you share the response headers? Specifically, x-served-by would be useful to see.

derekbekoe avatar Apr 22 '24 21:04 derekbekoe

Closing this as stale but please comment to clarify your use case if you continue to see an issue.

derekbekoe avatar Aug 05 '24 22:08 derekbekoe

I am not OP but noticed this the other day as well. I'm 100% sure the dev tunnel is stopped on my machine. Browsing to the tunnel, it takes it a few seconds then returns a 200 OK with no response body. Headers below confirm this response is coming from devtunnels.ms infrastructure.

To reproduce the issue:

  1. Create a dev tunnel and use it. Using .http file, postman, curl, or just browsing to the tunnel confirm it tunnels to your process and works as expected.
  2. Stop the dev tunnel in VS.
  3. Using .http file, postman, curl, or just browsing to the tunnel, observe the response takes longer, then returns a 200 and empty body.

Expected behavior is a 408, 404, 502, 503, or some other indication the request was not successful.

In my case, I am developing a power automate workflow, which in part calls back to the dev tunnel via an HTTP action. When the tunnel is down, the workflow's HTTP action gets a 200 indicating success. This causes confusion (ie workflow action sees successful response even when it actually failed). This also makes it harder to test error conditions - for example if I want to design my workflow to handle situations where the web server is down, I have to code my app to simulate that. I can't just turn off the dev tunnel. I suspect those developing various webhook responses would see similar.

content-length: 0

date: Fri, 16 Aug 2024 22:38:06 GMT ratelimit-limit: HttpRequestRatePerPort:1500/m ratelimit-remaining: HttpRequestRatePerPort:1499 ratelimit-reset: HttpRequestRatePerPort:9s strict-transport-security: max-age=31536000; includeSubDomains vssaas-request-id: 3dbed666-123f-49af-b110-16f826479122 x-content-type-options: nosniff x-ms-ratelimit-limit: x-ms-ratelimit-remaining: x-ms-ratelimit-reset: x-ms-ratelimit-used: 1 x-report-abuse: https://msrc.microsoft.com/report/abuse x-served-by: tunnels-prod-rel-use-v3-cluster

danroot avatar Aug 16 '24 22:08 danroot