Skip to content

fix: loading error pages after building shared config#102

Merged
StokesAsselborn merged 1 commit intodevfrom
bugfix/error-page-loading
Jan 13, 2026
Merged

fix: loading error pages after building shared config#102
StokesAsselborn merged 1 commit intodevfrom
bugfix/error-page-loading

Conversation

@StokesAsselborn
Copy link
Collaborator

To avoid going touching the SharedConfig struct and modifying the handlers etc, we are now doing the following :

  1. build_shared_config : populates std::map<HttpResponse::Status, std::string> error_pages where key = status and value = URI
  2. before returning the route in build_route_config(), we attempt load the error pages. On success, the URI is replaced by the HTML. On failure, the URI is removed to let the HttpResponse to use the default error pages.

No need to mention that this is no good practice and that we should rather use to distinct maps or a small struct for each error page. We can log this as enhancement.

@StokesAsselborn StokesAsselborn marked this pull request as ready for review January 13, 2026 09:44
@StokesAsselborn
Copy link
Collaborator Author

StokesAsselborn commented Jan 13, 2026

To test :

curl -i http://localhost:8080/does-not-exist
curl -i http://localhost:8080/override/
curl -i http://localhost:8080/nooverride/

files for testing route specific error_pages
@StokesAsselborn StokesAsselborn force-pushed the bugfix/error-page-loading branch from b2d1f25 to 6d97f55 Compare January 13, 2026 14:57
@StokesAsselborn StokesAsselborn merged commit f095996 into dev Jan 13, 2026
1 check passed
@StokesAsselborn StokesAsselborn deleted the bugfix/error-page-loading branch January 13, 2026 14:59
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.

1 participant