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

HTTP code 200 returned for invalid pages #1172

Closed
mueller-ma opened this issue Jul 27, 2021 · 3 comments · Fixed by #1600
Closed

HTTP code 200 returned for invalid pages #1172

mueller-ma opened this issue Jul 27, 2021 · 3 comments · Fixed by #1600

Comments

@mueller-ma
Copy link
Member

When connection to the openHAB server and try to access to notifications api (it's only on cloud, so this should produce an error), I get http code 200:

$ curl http://openhabian:8080/api/v1/settings/notifications -v
[...]
< HTTP/1.1 200 OK
< ETag: "1624816166000"
< Content-Type: text/html
< Content-Length: 1215
< Server: Jetty(9.4.40.v20210413)
[...]

This causes the Android app to recognize the server as cloud instance and tries to parse the response as json, but it's html. IMO the server should respond with 404 for not found subpages.

Browser for reference:
grafik

Android issue: openhab/openhab-android#2662

@wborn
Copy link
Member

wborn commented Sep 25, 2021

This is not an openhab-core issue but an openhab-webui Main UI issue.

It uses routes.js to determine what to show. It routes to not-found.vue when no route matches.

You can also test it by uninstalling the Main UI:

bundle:uninstall org.openhab.ui

Then you get a 404 not found for that URL. 😉
Perhaps @ghys can help with this.

@ghys
Copy link
Member

ghys commented Sep 26, 2021

This was indeed changed in #964 and that's an example of a "side effect" I was warning about.
We could make changes to restrict URL patterns that would be serving the main UI (whitelist or blacklist).

@wborn
Copy link
Member

wborn commented Sep 30, 2021

Can you transfer this issue to the webui repo @kaikreuzer?

@kaikreuzer kaikreuzer transferred this issue from openhab/openhab-core Sep 30, 2021
@wborn wborn mentioned this issue Jan 13, 2023
5 tasks
kaikreuzer pushed a commit that referenced this issue Mar 1, 2023
* Rework Servlets to use Http Whiteboard annotations in favor of
proprietary `org.openhab.core.io.http.servlet` classes

Depends on openhab/openhab-core#3252

Fixes #1172

Signed-off-by: Wouter Born <[email protected]>
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 a pull request may close this issue.

3 participants