-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Make additional_headers configurable #2236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems something was wrong with #2207
Despite being on this branch I get a lot of log output which was introduced with the mentioned PR
2025-02-21 22:49:54.001 CET [126824/T126940] INFO: NTP server listening on :::123 (IPv6)
2025-02-21 22:51:26.592 CET [126824/T126952] INFO: Local URI: "/admin/"
2025-02-21 22:51:26.643 CET [126824/T126953] INFO: Local URI: "/admin/login"
2025-02-21 22:51:26.724 CET [126824/T126952] INFO: Local URI: "/admin/vendor/fonts/SourceSansPro/SourceSansPro.css"
2025-02-21 22:51:26.724 CET [126824/T126953] INFO: Local URI: "/admin/vendor/nprogress/nprogress.min.css"
2025-02-21 22:51:26.724 CET [126824/T126954] INFO: Local URI: "/admin/vendor/bootstrap/css/bootstrap.min.css"
2025-02-21 22:51:26.762 CET [126824/T126952] INFO: Local URI: "/admin/vendor/animate/animate.min.css"
2025-02-21 22:51:26.763 CET [126824/T126953] INFO: Local URI: "/admin/vendor/bstreeview/bstreeview.min.css"
2025-02-21 22:51:26.764 CET [126824/T126954] INFO: Local URI: "/admin/vendor/select2/select2.min.css"
2025-02-21 22:51:26.797 CET [126824/T126952] INFO: Local URI: "/admin/style/pi-hole.css"
2025-02-21 22:51:26.797 CET [126824/T126953] INFO: Local URI: "/admin/vendor/adminLTE/AdminLTE.min.css"
2025-02-21 22:51:26.806 CET [126824/T126954] INFO: Local URI: "/admin/style/themes/default-dark.css"
2025-02-21 22:51:26.830 CET [126824/T126953] INFO: Local URI: "/admin/vendor/waitMe/waitMe.min.css"
2025-02-21 22:51:26.830 CET [126824/T126952] INFO: Local URI: "/admin/vendor/nprogress/nprogress.min.js"
2025-02-21 22:51:26.840 CET [126824/T126954] INFO: Local URI: "/admin/vendor/jquery/jquery.min.js"
2025-02-21 22:51:26.860 CET [126824/T126952] INFO: Local URI: "/admin/vendor/bootstrap/js/bootstrap.min.js"
2025-02-21 22:51:26.860 CET [126824/T126953] INFO: Local URI: "/admin/vendor/adminLTE/adminlte.min.js"
2025-02-21 22:51:26.872 CET [126824/T126954] INFO: Local URI: "/admin/vendor/bootstrap-notify/bootstrap-notify.min.js"
2025-02-21 22:51:26.889 CET [126824/T126952] INFO: Local URI: "/admin/vendor/font-awesome/all.min.js"
2025-02-21 22:51:26.889 CET [126824/T126953] INFO: Local URI: "/admin/scripts/js/utils.js"
2025-02-21 22:51:26.901 CET [126824/T126954] INFO: Local URI: "/admin/vendor/waitMe/waitMe.min.js"
2025-02-21 22:51:26.918 CET [126824/T126953] INFO: Local URI: "/admin/scripts/js/login.js"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
d9fd060
to
23683eb
Compare
…itable by users via the new config option webserver.headers Signed-off-by: DL6ER <dl6er@dl6er.de>
…heck for this during config parsing. Signed-off-by: DL6ER <dl6er@dl6er.de>
23683eb
to
10cfd31
Compare
Conflicts have been resolved. |
Rebased on latest |
Signed-off-by: DL6ER <dl6er@dl6er.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works, but 2 'issues'
- It needs a full FTL restart, the 'automatic' restart after the configuration has changed is not enough
- The moment, one presses 'save&apply' from 'All Settings' things go bad - the web interface does not include/render the
\r\n
which then don't get saved into thetoml
file and break the headers
Signed-off-by: DL6ER <dl6er@dl6er.de>
@yubiuser See my last commit: Instead of a long string, |
…idual headers. FTL will then take care of inserting the correct line endings itself Signed-off-by: DL6ER <dl6er@dl6er.de>
1089471
to
7ce1ef5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good. Works fine now. Last issue: When switching to this branch, the headers are empty by default
# array of HTTP headers
headers = [] ### CHANGED, default = [ "Content-Security-Policy: default-src 'self' 'unsafe-inline';", "X-Frame-Options: DENY", "X-XSS-Protection: 0", "X-Content-Type-Options: nosniff", "Referrer-Policy: strict-origin-when-cross-origin" ]
Signed-off-by: DL6ER <dl6er@dl6er.de>
You actually found a very old bug that is dating years back but we never noticed it because all other JSON arrays are by default empty. What happened here was that FTL reset the array content before parsing the existing TOML. This usually works. We have to reset the array before reading from the config file to avoid adding the config file entries on top of the default values. The glitch is not that, when the key is new and, hence, not present in The fix is simple: reset the array only when the key actually exists in the config file. |
What does this implement/fix?
Make additional_headers property of the embedded web server CivetWeb editable by users via the new config option
webserver.headers
. The default value of this variable has some best-practice headers.Related issue or feature (if applicable): #2215
Pull request in docs with documentation (if applicable): N/A
By submitting this pull request, I confirm the following:
git rebase
)Checklist:
developmental
branch.