Skip to content

server: use status code 403 for disabled features - #24970

Merged
ngxson merged 3 commits into
masterfrom
xsn/server_403_disabled_endpoints
Jun 25, 2026
Merged

server: use status code 403 for disabled features#24970
ngxson merged 3 commits into
masterfrom
xsn/server_403_disabled_endpoints

Conversation

@ngxson

@ngxson ngxson commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Overview

Return 403 + feature_disabled error type for disabled feature (CORS proxy, tools)

close #24894

Requirements

@ngxson
ngxson requested review from a team as code owners June 24, 2026 11:30
@ngxson ngxson changed the title Xsn/server 403 disabled endpoints server: use status code 403 for disabled features Jun 24, 2026
@github-actions github-actions Bot added the python python script changes label Jun 24, 2026
@pwilkin

pwilkin commented Jun 25, 2026

Copy link
Copy Markdown
Member

Request to add a condition to change it to code 418 on any date with month = 4, day = 1 ;)

@ngxson

ngxson commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

that may requires RFC 1149 to work correctly

Comment on lines +395 to 402
// 403 from /tools means the server was started without --tools
// TODO: check status code instead of relying on message
if (errorMessage.includes('this feature is disabled')) {
this._toolsEndpointUnreachable = true;
console.info('[ToolsStore] Built-in tools are disabled on the server');
} else {
console.error('[ToolsStore] Failed to fetch built-in tools:', err);
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @allozaur maybe better to expose the status code in Error object, but I'll let you to improve it if needed

@ngxson
ngxson merged commit e9d1b76 into master Jun 25, 2026
30 of 31 checks passed
papamoose pushed a commit to papamoose/llama.cpp that referenced this pull request Jun 27, 2026
* server: use status code 403 for disabled features

* cont

* fix test case
adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request Jul 5, 2026
* server: use status code 403 for disabled features

* cont

* fix test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misc. bug: Server UI HTTP 404 on /tools

4 participants