EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #09837
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Change oai2 base_url
- To: <eprints-tech@ecs.soton.ac.uk>, Agung Prasetyo W. <prazetyo@gmail.com>
- Subject: Re: [EP-tech] Change oai2 base_url
- From: David R Newman <drn@ecs.soton.ac.uk>
- Date: Tue, 10 Sep 2024 08:22:38 +0100
Hi Agung,
If you just want to update this you just need to change the following line in oai.pl to the the line below. I would recommend creating a z_oai.pl in your archive rather than editing the version under EPRINTS_PATH/flavours/pub_lib/cfg.d/.
$oai->{v2}->{base_url} = $c->{perl_url}."/oai2";
$oai->{v2}->{base_url} = "https://".$c->{securehost}."/cgi/oai2";
However, this is a bit of a hack. What is better to do, is make sure that perl_url with always return https. I think your issue is likely to be one of two issues.
1. Your archive (or possibly lib/cfg.d/ directory) has an old version of cfg/cfg.d/20_baseurls.pl. It should have a version (note this is just a snippet not the whole file) like below to ensure when securehost is set it https URLs are configured by default.
{
my $uri = URI->new( "http://" );
if( EPrints::Utils::is_set( $c->{securehost} ) )
{
$uri->scheme( "https" );
$uri->host( $c->{securehost} );
$uri->port( $c->{secureport} );
$uri = $uri->canonical;
$uri->path( $c->{https_root} );
}
else
{
$uri->scheme( "http" );
$uri->host( $c->{host} );
$uri->port( $c->{port} );
$uri = $uri->canonical;
$uri->path( $c->{http_root} );
}
# EPrints base URL without trailing slash
$c->{base_url} = "$uri";
# CGI base URL without trailing slash
$c->{perl_url} = "$uri/cgi";
# Uncomment to keep URI for eprint items as http or different to base_url.
# May need editing, if repository on unusual port number, not on the root path or host is unset because HTTPS everywhere is configured.
#$c->{uri_url} = "http://" . $c->{host};
}
2. If your 20_baseurls.pl comes
alphabetically before the configuration file that sets
$c->{securehost}. I have seen some older EPrints repositories
where this has been set in the archive's cfg/cfg.d/https.pl, which
will load after 20_baseurls.pl and therefore cause the latter to
use http URLs by default. In these cases I have either moved
https.pl to 15_https.pl or just copied its config into 10_core.pl.
Once you have made these changes, you should only need to reload Apache to apply them.
Regards
David Newman
On 10/09/2024 5:15 am, Agung Prasetyo W. wrote:
Once you have made these changes, you should only need to reload Apache to apply them.
Regards
David Newman
On 10/09/2024 5:15 am, Agung Prasetyo W. wrote:
CAUTION: This e-mail originated outside the University of Southampton.CAUTION: This e-mail originated outside the University of Southampton.Hi,
How I can change oai2 base_url from http to https. I already changed my eprints url to https, but in https://repository.dinamika.ac.id/cgi/oai2?verb=Identify it still http.
Please need help.
Thank you.
Regards,Agung PW
*** Options: https://wiki.eprints.org/w/Eprints-tech_Mailing_List *** Archive: https://www.eprints.org/tech.php/ *** EPrints community wiki: https://wiki.eprints.org/
- Follow-Ups:
- Re: [EP-tech] Change oai2 base_url
- From: "Agung Prasetyo W." <prazetyo@gmail.com>
- Re: [EP-tech] Change oai2 base_url
- References:
- [EP-tech] Change oai2 base_url
- From: "Agung Prasetyo W." <prazetyo@gmail.com>
- [EP-tech] Change oai2 base_url
- Prev by Date: [EP-tech] Change oai2 base_url
- Next by Date: Re: [EP-tech] Change oai2 base_url
- Previous by thread: [EP-tech] Change oai2 base_url
- Next by thread: Re: [EP-tech] Change oai2 base_url
- Index(es):