Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect message and HTTP status code when no instance is available #980

Conversation

hprange
Copy link
Contributor

@hprange hprange commented Apr 27, 2022

This bug has been around for at least 19 years, as described on this thread. The WebObjects adaptor may return an incorrect HTTP status code and message when no instance of an application is available to handle the request. It's fairly easy to reproduce the problem:

  1. Set up a WebObjects application with a single instance.
  2. Try to access the application from a browser with the instance stopped.
GET - /cgi-bin/WebObjects/my-app.woa/wa/default

Status: 500
Message: No instance available
  1. Reload the browser, and you'll get a different response.
GET - /cgi-bin/WebObjects/my-app.woa/wa/default

Status: 404
Message: The requested application was not found on this server

When no instance is available, returning a 404 status code is problematic, especially if the URL being accessed is part of a REST API. This fix will ensure that the WebObjects adaptor will return the correct HTTP status code and message for every request when no instance is available.

This bug has been around for at least 19 years, as described on [this thread](https://webobjects-dev.omnigroup.narkive.com/7gWK5EfH/http-500-error-a-nightmare). The WebObjects adaptor may return an incorrect HTTP status code and message when no instance of an application is available to handle the request. It's fairly easy to reproduce the problem:

1. Set up a WebObjects application with a single instance.
2. Try to access the application from a browser with the instance stopped.

```
GET - /cgi-bin/WebObjects/my-app.woa/wa/default

Status: 500
Message: No instance available
```

3. Reload the browser, and you'll get a different response.

```
GET - /cgi-bin/WebObjects/my-app.woa/wa/default

Status: 404
Message: The requested application was not found on this server
```

When no instance is available, returning a 404 status code is problematic, especially if the URL being accessed is part of a REST API. This fix will ensure that the WebObjects adaptor will return the correct HTTP status code and message for every request when no instance is available.
@hprange hprange self-assigned this Apr 27, 2022
@darkv darkv merged commit ca186e7 into wocommunity:master Jun 3, 2022
@hprange hprange deleted the bugfix/mod-webobjects-no-instance-available branch June 3, 2022 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants