Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
HTTPS-only and HSTS
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{manual}} [[Category:Authentication]] == HTTPS with EPrints == See the pages in [[:Category:Authentication|Category Authentication]] for how to setup up HTTPS on EPrints, for example: *[[How_to_use_EPrints_with_HTTPS|How to use EPrints with HTTPS]] *[[Setting_up_HTTPS_using_Let%27s_Encrypt|Setting up HTTPS using Let's Encrypt]] The following is a description of how to configure EPrints so that all content, not just login pages, is served over HTTPS. == Google Best Practices for HTTPS== The following are the best practices specified by [https://support.google.com/webmasters/answer/6073543?hl=en&ref_topic=6001951 Google] * HSTS Headers on HTTPS * No “Mixed Content” warnings/errors * Links point to HTTPS locations * 301 Redirects from HTTP to HTTPS == HSTS == To summarize how HSTS works, if a browser (Chrome, Firefix, IE) sees the HSTS header in the HTTPS response, and there are no certificate errors or mixed content warnings or anything (if it is green), then the next time a user of that browser requests the HTTP page of that site, the browser will modify the request from an HTTP to a HTTPS request. The browser will remember that setting for as long as you specify <tt>max-age</tt> to be. This means that even with HSTS, it is still possible to request and receive content over HTTP. To close that down, a server redirect is necessary, so those browsers that haven’t seen the HSTS header in the past that happen to try to go to HTTP will get that initial redirect to HTTPS. == Implementing HTTPS-only with HSTS on an EPrints repository == === Changes to archive's cfg.d/10_core.pl === Initialize the following variables to be the https URL (i.e., https://<nowiki>YOUR-REPOSITORY-DOMAIN</nowiki>) <source lang="perl"> $c->{host} = "YOUR-REPOSITORY-DOMAIN"; $c->{http_url} = 'https://YOUR-REPOSITORY-DOMAIN'; $c->{http_cgiurl} = 'https://YOUR-REPOSITORY-DOMAIN/cgi'; $c->{base_url} = "https://$c->{host}"; </source> === Changes to archive's <tt>cfg/lang/LANGID/templates/default.xml</tt>, and <tt>/cfg/lang/LANGID/static/*.XPAGE</tt> files === * Remove any hard coded links to HTTP * If you have Google Search included as an XPAGE file, call on the Google API (and any other APIs) using HTTPS. === Changes to Apache config files === ==== Add the HSTS header ==== Edit [[Template:Securevhost.conf|EPRINTS_PATH/archives/REPOID/ssl/securevhost.conf]] and add the following HSTS header after ther <tt>ServerName</tt> line. The max-age variable is a time in seconds for how long the HSTS settings should be remembered by the browser. 15780000 is six months, which is a long time, you may want to set it to a shorter time while testing. <syntaxhighlight lang="apache"> Header set Strict-Transport-Security "max-age=15780000" </syntaxhighlight> Include this file from the core apache conf file for the secure port (443) in <tt>/etc/</tt> ==== Add 301 redirects to secure port from HTTP (port 80) ==== By making the above changes to the archive's <tt>cfg.d/10_core.pl</tt>, if you use [https://github.com/eprints/eprints/commit/c29574dbdcd49c67f3aea522998960f2eb19f544 this patch] or are running [https://github.com/eprints/eprints the latest revision of EPrints on GitHub], <tt>/bin/generate_apacheconf</tt> will generate an <tt>/cfg/apache/REPOID.conf</tt>, which automatically redirects HTTP to HTTPS. Otherwise, this can be achieved by modifying <tt>/cfg/apache/REPOID.conf</tt> to the following, substituting your domain as appropriate: <source lang="xml"> <VirtualHost *:80> RedirectPermanent / https://YOUR-REPOSITORY-DOMAIN/ </VirtualHost> </source>
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Box
(
edit
)
Template:Manual
(
edit
)