EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #09598

< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Eprints with Nginx Proxy Manager as Load Balancer

Hi Zen,

This looks to be a mixed content issue.  EPrints has evolved over time from a time before HTTPS was widely available, through a time where HTTPS was needed but only for administration pages, to a time where HTTPS is almost exclusively used with HTTP requests upgraded either by the browser or by HTTP to HTTPS redirects.

I think you issue is that you have EPrints running with an HTTP-only configuration but your NGinX proxy is HTTPS. Sometimes EPrints uses full URLs, which include a protocol (i.e. HTTP or HTTPS) and this is where you mixed content warnings are arising.  In an ideal world EPrints would only use relative URLs but as content is often embedded in third-party application there is still a requirement for full URLs in certain places.  (We have experimented with protocol independent URLs, e.g. //eprints.example.org/cgi/users/login.  However, if anything this added to the complexity of different types of URL being generated, so was decided against).

Anyway, to solve your problem you want to run you EPrints repository on your server in HTTPS-only rather than HTTP-only mode by reconfiguring your archive's cfg/cfg.d/10_core.pl (see [1]).  You should only require a self-signed HTTPS certificate [2] as your NGinX proxy should be configurable to just care what the port number and protocol (i.e. HTTPS or HTTP) are.  You will also need to add an HTTPS virtualhost.  There is a good example on [3] but you will need to update the SSLCertificate... lines to point at you self-signed certificate and key (you should not need a SSLCertificateChainFile for a self-signed certificate). 

Once you have redone all this configuration and tested it.  Make sure you regenerate your Apache configuration and restart Apache and also clear any caches that may still be using HTTP URLs:

EPRINTS_PATH/bin/epadmin test
EPRINTS_PATH/bin/generate_apacheconf --system --replace
apachectl restart
EPRINTS_PATH/bin/epadmin refresh_views ARCHIVE_ID
EPRINTS_PATH/bin/epadmin refresh_abstracts ARCHIVE_ID
EPRINTS_PATH/bin/generate_static ARCHIVE_ID


David Newman

[1] https://wiki.eprints.org/w/Simplified_HTTPS_Configuration
[2] https://gist.github.com/taoyuan/39d9bc24bafc8cc45663683eae36eb1a
[3] https://wiki.eprints.org/w/Setting_up_HTTPS_using_Let%27s_Encrypt

On 12/02/2024 07:03, zen zenitram wrote:
CAUTION: This e-mail originated outside the University of Southampton.
Good day!

 still can't upload and delete files. Here is error when i tried to upload.

On Wed, Jan 31, 2024 at 9:52 PM David R Newman <drn@ecs.soton.ac.uk> wrote:

Hi Zen,

It is difficult to debug an issue when you have a proxy sitting in front of your EPrints repository with no information about how that proxy has been configured.  However, I have taken a look at the Upload stage on my EPrints test repository running the latest version of EPrints and I can see a request that is locally blocked that relates to the iframe generated by _javascript_ to provide the upload progress*.  To avoid getting this blocked request (which may be causing your error message and upload issues) I would recommend commenting out the following line from EPRINTS_PATH/lib/static/_javascript_/auto/88_uploadmethod_file.js:

hidden_iframe.setAttribute( 'src', '#' );

So that it becomes:

// hidden_iframe.setAttribute( 'src', '#' );

This is on around line 314 for 88_uploadmethod_file.js.  Once you have done this you will need to hard reload (e.g. Ctrl+Shift+R) the Upload stage of the workflow in your web browser and this should update your main _javascript_ file.  Then try uploading a file again.  If this does not work do you get  the same error message.  If you get the same error message, it is worth taking a look at https://thesis.dlsud.edu.ph/_javascript_/auto-VERSION.js (substituting VERSION for you version, e.g. 3.4.5) to make sure this line above is now commented out there.  If it is not commented out, try using a private/incognito browser window to test this to try to avoid any caching of the old _javascript_.


David Newman

*This is a very ugly way of managing upload but was needed when the uploader was first written.  We plan to completely overhaul how the uploader works for the next major version of EPrints.

On 31/01/2024 02:17, zen zenitram wrote:
CAUTION: This e-mail originated outside the University of Southampton.
CAUTION: This e-mail originated outside the University of Southampton.
Good day! 

Our eprints repository works fine with it, you can log in and search and open attached documents. The Problem occurs when we try to add new title to repository and upload pdf files. attached are the errors shows when we upload documents. 

and also when we try to delete the attached pdf file it only gives black page instead of the delete option.

Thank you!

*** Options: https://wiki.eprints.org/w/Eprints-tech_Mailing_List
*** Archive: https://www.eprints.org/tech.php/
*** EPrints community wiki: https://wiki.eprints.org/