What else can cause a 404?

Hi all,

I have a hosted servicestack web app on which I’m submitting a GET request to a DeckSearches service.

For some reason a certain combination of properties on the request object causes a 404 and I’m trying to get the hosting company to understand that it isn’t ServiceStack (as the same thing doesn’t happen on any of my local environments with the same codebase, db etc).

I can perform a search with (Format = Standard and Min Dice = 6) and get a number of results successfully.
I can then decrease the Min Dice value down through 5 and 4 and continue to get results.

But, I get a 404 if I then lower it again to 3. The query string doesn’t change other than changing the minDice value from 4 to 3 yet it throws a NotFound exception. I’m certain this is something to do with the hosted IIS environment but would appreciate some ideas on how this can be the case, if anyone has any…?

The main impact I would expect lowering the minDice value would have is to increase the size of the response object (quite substantially), could that be anything to do with it?
My issue with this is that it appears to throw the exception within a couple of seconds but I would expect the corresponding db search to take about 10 seconds before anything was aware of the response object’s size…

I’m stumped…

This description isn’t useful on its own, you really need to be looking at the underlying HTTP Request/Response headers and comparing them to see what the actual differences are. Whether both requests are being handled by ServiceStack or if it fails before it reaches ServiceStack, whether there’s something different about how the requests are created, what other info is available in the 404 responses, etc.

ok thanks - let me see what I can find…

OK, so using websniffer for my requests…

With minDice = 6 (https://deckgenesis.com/api/decks/search?formatCode=STD&minDice=6&take=100)

HTTP Request Header

Connect to 92.53.241.38 on port 443 … ok

GET /api/decks/search?format=json&formatCode=STD&minDice=4&take=100 HTTP/1.1
User-Agent: WebSniffer/1.0 (+http://websniffer.cc/)
Host: deckgenesis.com
Accept: /
Referer: https://websniffer.cc/
Connection: Close

I get a response 200…

HTTP Response Header

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html
Vary: Accept
Server: Microsoft-IIS/10.0
X-Powered-By: ServiceStack/5.50 Net45/Windows
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: Content-Type
X-AspNet-Version: 4.0.30319
X-Powered-By: www.WebWiz.net
Date: Mon, 01 Jul 2019 20:40:09 GMT
Connection: close
Content-Length: 84260

but with minDice = 3 (https://deckgenesis.com/api/decks/search?formatCode=STD&minDice=3&take=100)

HTTP Request Header

Connect to 92.53.241.38 on port 443 … ok

GET /api/decks/search?format=json&formatCode=STD&minDice=3&take=100 HTTP/1.1
User-Agent: WebSniffer/1.0 (+http://websniffer.cc/)
Host: deckgenesis.com
Accept: /
Referer: https://websniffer.cc/
Connection: Close

I get a 404…

HTTP Response Header

HTTP/1.1 404 Not Found
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Vary: Accept
Server: Microsoft-IIS/10.0
X-Powered-By: ServiceStack/5.50 Net45/Windows
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: Content-Type
X-AspNet-Version: 4.0.30319
X-Powered-By: www.WebWiz.net
Date: Mon, 01 Jul 2019 20:41:46 GMT
Connection: close
Content-Length: 3

So I guess we’re hitting ServiceStack in both scenarios?

Please include the Request Headers for both as well.

Does your Service throw a NotFound Exception for any reason? What does your implementation do? Does it make a 3rd Party API call? And does that return a 404 for any reason?

It says you’re going through WebWiz.net, is that some kind of proxy and does that provide its own caching? If it does then it could be returning a cached version, try seeing if you can break the cache with an additional param with a unique number, e.g:

https://deckgenesis.com/api/decks/search?formatCode=STD&minDice=3&take=100&t=1234

It’s your Service that’s throwing the 404 when it catches any Exception.

catch (Exception ex)
{
    throw HttpError.NotFound(ex.Message);
}

Remove that Exception and let it the original Exception bubble and make sure you have a ResponseStatus in your Response DTO to see details about what the Exception is:

public class DeckSearchResponse
{
    public ResponseStatus ResponseStatus { get; set; }
}

You’ll need to enable DebugMode in order to view the StackTrace in the response.

Oh jeez, that’s embarrassing - I simply didn’t see the try catch!

Sorry @mythz for wasting your time

Thanks for your help anyway

1 Like