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

REST Health service error #634

Open
maniac777 opened this issue Dec 21, 2021 · 2 comments
Open

REST Health service error #634

maniac777 opened this issue Dec 21, 2021 · 2 comments

Comments

@maniac777
Copy link

Describe the bug
In current version of application GIT main and in previous release health reset service is not responding.

To Reproduce
Steps to reproduce the behavior:

  1. Enable public health service.
  2. Try to call it with following headers:
GET /pwm/public/rest/health HTTP/1.1
User-Agent: check_http/v2.1.1 (monitoring-plugins 2.1.1)
Connection: close
Host: __DOMAIN__
Accept: */*

HTTP/1.1 200
Date: Tue, 21 Dec 2021 08:07:02 GMT
Server: PWM
Vary: Accept-Encoding
Content-Language: en
X-PWM-Noise: NrYK7GhqY6mqmG4prVj
X-Content-Type-Options: nosniff
X-XSS-Protection: 1
X-PWM-Instance: 37F1484C92C74383
X-Frame-Options: DENY
X-PWM-Amb: j00s j0ur d4ddy
Cache-Control: no-cache, no-store, must-revalidate, proxy-revalidate
Content-Type: application/json;charset=UTF-8
Content-Length: 74
X-Robots-Tag: noindex, noarchive, nosnippet
Connection: close
**** CONTENT ****
{"error":true,"errorCode":7000,"errorMessage":"Error_RestInvocationError"}

Expected behavior
I expect to receive json object with health status as in previous releases.

@maniac777
Copy link
Author

maniac777 commented Dec 21, 2021

I've debugged out a problem a bit with colegue. He found out that in server/src/main/java/password/pwm/ws/server/rest/RestHealthServer.java there are two methods:

  1. @RestMethodHandler( method = HttpMethod.GET, produces = HttpContentType.plain )
    private RestResultBean doPwmHealthPlainGet( final RestRequest restRequest )
  2. @RestMethodHandler( method = HttpMethod.GET, consumes = HttpContentType.json, produces = HttpContentType.json )
    private RestResultBean doPwmHealthJsonGet( final RestRequest restRequest )

This was a hint. In first method any error is catched. So this was a hint that i did not hit the first method. Setting request header "Content-Type: text/plain" clould be enaugh to make it working.

I believe that this should be fixed to give some more helpfull error message, documented or fixed in the way that content-type is not required in GET request.

@msoltyspl
Copy link

msoltyspl commented Feb 7, 2023

For the record, this is still an issue in version 2.0.4 (forcing content-type to application/json with e.g. curl's -H workarounds the issue as well)

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

No branches or pull requests

2 participants