Skip to content

[FEATURE] Write static headers to to the server config file#6

Merged
zero-24 merged 41 commits intomasterfrom
saveToServerConfigFile
Apr 20, 2019
Merged

[FEATURE] Write static headers to to the server config file#6
zero-24 merged 41 commits intomasterfrom
saveToServerConfigFile

Conversation

@zero-24
Copy link
Copy Markdown
Owner

@zero-24 zero-24 commented Feb 18, 2019

Hi,

this is the code for the next feature update of the plugin adding support to write the static headers to the .htaccess and web.config files without interaction of the user as well as updating the values when already set when the user saves the extension from the backend.

New Language strings

Here are the new language strings shipped with this feature please let me know whether any of this is unknown or can be improved. When you get the time please send the new translated strings to this branch here: https://github.com/zero-24/plg_system_httpheader/tree/saveToServerConfigFile or post them here as comment and i can commit them on your behalf.
Please let me know when you have any questions or remarks on the strings.

cc @pe7er (ne-NL) @YGomiero (fr-FR) @brianteeman (en-GB)

PLG_SYSTEM_HTTPHEADER_WRITE_STATIC_HEADERS="Write headers to the configuration file"
PLG_SYSTEM_HTTPHEADER_WRITE_STATIC_HEADERS_DESC="When enabled the headers (excluding the Content-Security-Policy) will be added to the existing server configuration file as soon as you save this extension. This way the headers will be enforced from the server side. At this time we only support .htaccess (Apache) and web.config (IIS) files."
PLG_SYSTEM_HTTPHEADER_MESSAGE_STATICHEADERS_NOT_WRITTEN_NO_SERVER_CONFIGFILE_FOUND="We couldn't find any active .htaccess or web.config file to apply the rules to. Please first rename the htaccess.txt to .htaccess or web.config.txt to web.config and make sure the configuration files works."
PLG_SYSTEM_HTTPHEADER_MESSAGE_STATICHEADERS_WRITTEN="All static headers have been written to the server configuration file."
PLG_SYSTEM_HTTPHEADER_MESSAGE_STATICHEADERS_NOT_WRITTEN="Your %1$s file is not writable or there was a problem creating the file. You will have to upload the following code by hand. Select the following code and then paste into a new text file. Name this file '%1$s' and upload it to your site root folder.<br><pre>%2$s</pre>"

How to test

Install this package representing the latest development version and report any issues remarks here:
plg_system_httpheader.zip

I would like to ask @SniperSister and @yvesh to take a look from the PHP side and give this an review, but also any other kind of feedback is appreciated :)

Additional note

When ready the plan is this to be merged up to the version of this plugin shipped with Joomla 4.0 too.

Thanks for your support 👍

@brianteeman
Copy link
Copy Markdown

PLG_SYSTEM_HTTPHEADER_WRITE_STATIC_HEADERS="Write headers to the configuration file"
PLG_SYSTEM_HTTPHEADER_WRITE_STATIC_HEADERS_DESC="When enabled the headers (excluding the Content-Security-Policy) will be added to the existing server configuration file as soon as you save this extension. This way the headers will be enforced from the server side. At this time we only support .htaccess (Apache) and web.config (IIS) files."
PLG_SYSTEM_HTTPHEADER_MESSAGE_STATICHEADERS_NOT_WRITTEN_NO_SERVER_CONFIGFILE_FOUND="We couldn't find any active .htaccess or web.config file to apply the rules to. Please first rename the htaccess.txt to .htaccess or web.config.txt to web.config and make sure the configuration files works."
PLG_SYSTEM_HTTPHEADER_MESSAGE_STATICHEADERS_WRITTEN="All static headers have been written to the server configuration file."
PLG_SYSTEM_HTTPHEADER_MESSAGE_STATICHEADERS_NOT_WRITTEN="Your %1$s file is not writable or there was a problem creating the file. You will have to upload the following code by hand. Select the following code and then paste into a new text file. Name this file '%1$s' and upload it to your site root folder.<br><pre>%2$s</pre>"

@zero-24
Copy link
Copy Markdown
Owner Author

zero-24 commented Feb 18, 2019

Thanks @brianteeman I have just updated the branch and the PR description. Thanks.

@pe7er
Copy link
Copy Markdown
Contributor

pe7er commented Feb 25, 2019

@zero-24 I've added the new nl-NL strings with PR: #8

@zero-24
Copy link
Copy Markdown
Owner Author

zero-24 commented Feb 25, 2019

Thanks I will only apply alpha ordering of the strings when i get back on the code, hopefully tomorrow :-)

@zero-24
Copy link
Copy Markdown
Owner Author

zero-24 commented Mar 24, 2019

Thanks @brianteeman for the language suggestions. I have just pushed them as a single commit your suggestions are very much appreciated. 👍

@zero-24
Copy link
Copy Markdown
Owner Author

zero-24 commented Apr 20, 2019

Ok merging this now. Thanks all for your help and feedback on this one
@brianteeman
@pe7er
@SniperSister
@ReLater
@Sandra97
@jeckodevelopment

As soon as the com_csp PR (joomla/joomla-cms#24365) is merged I can start preparing to move this to 4.0 too as the config is moved there and I don't want to run into conflicts where i miss to change an config string ;)

@zero-24 zero-24 merged commit 10a9b1c into master Apr 20, 2019
@zero-24 zero-24 deleted the saveToServerConfigFile branch April 20, 2019 06:54
@zero-24
Copy link
Copy Markdown
Owner Author

zero-24 commented Apr 20, 2019

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants