EPrints Technical Mailing List Archive

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

Message: #10061


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

Re: [EP-tech] Links dynamically generated lose the "/cgi" part


Hi Gunnar,

There are various configuration settings in EPrints, which are mostly auto-generated from other settings or defaults.  The ones that generate URLs that should typical contain a /cgi/ are as follows:

$c->{http_cgiurl}
$c->{https_cgiurl}
$c->{perl_url}
$c->{rel_cgipath}
$c->{http_cgiroot}
$c->{https_cgiroot}
$c->{userhome}

Based on your explanation, it looks like $c->{https_cgiurl} is the configuration setting at issue.  I would check under you archive's configuration (EPRINTS_PATH/archive/ARCHIVE_ID/cfg/cfg.d/) and see if this setting is set anywhere else that where you set this.  It may be that this configuration setting  is not in your archive, so if you cannot find the configuration setting under you archive, if you go under your EPrints path and then look under the following sub-paths for this configuration setting. (N.B. use of the wildcard character under flavours and ingredients as there may be multiple sub-directories):

lib/cfg.d/
flavours/*/cfg.d/
site_lib/cfg.d/
ingredients/*/cfg.d/

If you still cannot find the configuration setting, get back to me with what you have found and I shall see if I can advise further.  I doubt that any default configuration setting under any of these directories is missing "cgi" but it is possible it was accidentally or deliberately changed to fix another problem at some point.

Also, I would not usually set the setting the way that you did, although I think the way you did it should work.  I would set it like this:

$c->{https_cgiurl} = "https://"; . $c->{securehost} . "/cgi";

This assumes that $c->{securehost} is already set in an earlier configuration file.  Configuration files load in alphanumeric order.  This possibly explains why you configured $c->{https_cgiurl} but then a later configuration file overwrote this.

Regards

David Newman

On 24/03/2025 5:36 am, Gunnar Wolf wrote:
CAUTION: This e-mail originated outside the University of Southampton.

CAUTION: This e-mail originated outside the University of Southampton.

Hello again,

After asking last week and failing to isolate the cause for my repository to have a broken handling for http→https, I ended up reverting my configuration to what I had on backup — my repository is now serving part of the links via http,
part via https, and I cannot seem to understand how to fix it.

But, sigh, lets continue — At least I can work with the repository! However...

When connecting via http, things work mostly fine. Only that, browsers (and
aggregators) nowadays shun insecure http connections.

And when I connect via https, links non-statically generated miss the "/cgi" component (that is, i.e. when I click on "New element" from "My deposits" or on
any of the icons to work with a specific existing item, the browser opens
/users/home instead of /cgi/users/home). Of course, this gives me an ugly 404
error.

Following the advice given by John Salter, I queried the running configuration,
and found that:

    $ perl -I/usr/share/eprints3/perl_lib/ -e 'use EPrints; use Data::Dumper; $Data::Dumper::Maxdepth=2; $s = new EPrints::Session(1, "iiec", 0); print Dumper($s->{config});' | egrep https?_cgiurl                  'http_cgiurl' => bless( do{\(my $o = 'https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fru.iiec.unam.mx%2Fcgi&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Ca532c09b289c48240fba08dd6ab41aeb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638784044022277163%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=sHhNs3RSJayUDS94iLovHBqmKTxSWNTa%2B1wVB0oHxhM%3D&reserved=0')}, 'URI::http' ),                  'https_cgiurl' => bless( do{\(my $o = 'https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fru.iiec.unam.mx%2F&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Ca532c09b289c48240fba08dd6ab41aeb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638784044022299826%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=61OyGyHacoHU%2FOiOtNdlNOMgi%2BB69JJTsxrJ%2F%2FYzA6c%3D&reserved=0')}, 'URI::http' ),

Which is exactly what I would expect to yield this behavior (although I don't
understand _why_ it does).

I tried adding the following to archives/iiec/cfg/cfg.d/20_baeurls.pl:

    $c->{https_cgiurl} = URI::https->new( "https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fru.iiec.unam.mx%2Fcgi&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Ca532c09b289c48240fba08dd6ab41aeb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638784044022312304%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=HbekaHfOiS5pADGQehhTNuxWvY112wS05zwqB7MqbFA%3D&reserved=0";);

Now, the values obtained from dumping $s->{config} are correct:

    $ perl -I/usr/share/eprints3/perl_lib/ -e 'use EPrints; use Data::Dumper; $Data::Dumper::Maxdepth=2; $s = new EPrints::Session(1, "iiec", 0); print Dumper($s->{config});' | egrep https?_cgiurl                  'https_cgiurl' => bless( do{\(my $o = 'https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fru.iiec.unam.mx%2Fcgi&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Ca532c09b289c48240fba08dd6ab41aeb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638784044022322072%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=rp3qeW9I4%2FhjTZH%2BL9g0YLAj9TIXHONnPim4hHiNb8s%3D&reserved=0')}, 'URI::https' ),                  'http_cgiurl' => bless( do{\(my $o = 'https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fru.iiec.unam.mx%2Fcgi&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Ca532c09b289c48240fba08dd6ab41aeb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638784044022331476%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=n0%2Bn63vaGPNk8DSdntJgRIyH%2F9fME9JYGDqJ4EdcEug%3D&reserved=0')}, 'URI::http' ),

... But, even after restarting Apache,the links are still missing /cgi

What am I missing here?

Thanks again!

  – Gunnar.

*** Options: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FEprints-tech_Mailing_List&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Ca532c09b289c48240fba08dd6ab41aeb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638784044022340788%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=6fECEFJ4cD55Vc6cu2SEaweh07Nm363eTAQOwqVpbCs%3D&reserved=0
*** Archive: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Ca532c09b289c48240fba08dd6ab41aeb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638784044022349707%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=FlNEaA1LMLkJG2au03Z2tsjh6B8xvCdROEATNkHnh4Y%3D&reserved=0
*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2F&data=05%7C02%7Ceprints-tech%40ecs.soton.ac.uk%7Ca532c09b289c48240fba08dd6ab41aeb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C638784044022359090%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Fe%2FX%2FeEIUXLTXizkL4gwGXTwC3Tu260qZ4rNvWfc0ek%3D&reserved=0