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

NEW Allow silverstripe/errorpage to static publish #64

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

NightJar
Copy link
Contributor

When using the error page module to create custom content error pages within the CMS (for e.g. HTTP 404 & 500) the default is to also static publish these files so the web server can reference them directly. This requires an unauthenticated execution of the controller in a mocked request in order to get all the page HTML without revealing any user based customised data that may be present. SAMLMiddleware will currently redirect this request to the IdP for authentication when enabled, essentially preventing error pages from being published, ever (in the default configuration).

Hooks to customise the environment before dispatching the mocked request to the error page controller have recently been added to the ErrorPage, allowing us to disable the middleware & re-set it after the mock request completes. We can apply this via config only if the module exists.

Resolves #32

When using the error page module to create custom content error pages
within the CMS (for e.g. HTTP 404 & 500) the default is to also static
publish these files so the web server can reference them directly. This
requires an unauthenticated execution of the controller in a mocked
request in order to get all the page HTML without revealing any user
based customised data that may be present. SAMLMiddleware will currently
redirect this request to the IdP for authentication when enabled,
essentially preventing error pages from being published, ever (in the
default configuration).

Hooks to customise the environment before dispatching the mocked request
to the error page controller have recently been added to the
ErrorPage, allowing us to disable the middleware & re-set it after the
mock request completes. We can apply this via config only if the module
exists.
@NightJar
Copy link
Contributor Author

This will use silverstripe/silverstripe-errorpage#124 when it is released. But the impact in the meantime is none*, as it will simply apply an extension that is never called.

*perhaps an extreeeeeeeeeeemly insigificant amount of processing time

@madmatt
Copy link
Member

madmatt commented Oct 29, 2024

Nice one! What's the chance you'll have some time to write a test for this new functionality in the near future? The module doesn't exactly have a lot of coverage, but the more we can add the better :)

@madmatt madmatt merged commit 41088ca into silverstripe:main Oct 29, 2024
@NightJar NightJar deleted the allow-error-pages branch October 29, 2024 19:59
@NightJar
Copy link
Contributor Author

Nice one! What's the chance you'll have some time to write a test for this new functionality in the near future? The module doesn't exactly have a lot of coverage, but the more we can add the better :)

Test for this included in #68

doesn't exactly have a lot of coverage

It will now :)

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.

Cannot publish error page with enable_static_file set to true
2 participants