[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] technical question: one archive with two domains



Hi Thorsten,

If your page includes an html tag:
<base href=http://domain1.com/"; />
Then any href tags that are relative e.g. <a href="/my_page.html">?</a> would link to http://domain1.com/my_page.html.
If the base tag was changed to:
<base href=http://domain2.com/"; />
The same link would go to http://domain2.com/my_page.html - which I think is what you're trying to do?

In <eprints_root>/archives/<archiveid>/cfg/cfg.d/dynamic_template.pl
you could then do something like (keeping the stuff that's there already!):

$c->{dynamic_template}->{function} = sub {
        my( $repository, $parts ) = @_;

        # do stuff to work out what protocol was used,
        my $r = $repository->request;
        # do stuff to work out what hostname was requested, which protocol was used etc.
        # not sure how to do this off the top of my head!
        # possibly things like $r->hostname ?

        my $base = $repository->make_doc_fragment;
        $base->appendChild( $repository->make_element( "base", href=> "$protocol://$hostname" ) );
        $parts->{base} = $base;
?
};

In your template, you would then add a pin (in the <head>): <epc:pin ref="base" />
https://wiki.eprints.org/w/API:EPrints/Apache/Template
Alternatively you could append it to the 'head' pin (again, off the top of my head, can't think of how to do this).

As I said, this might be a really bad idea (or might just not work!)? but if you're willing to experiment, it might help somehow!

Cheers,
John


From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Thorsten B?lo
Sent: 09 March 2017 13:29
To: eprints-tech at ecs.soton.ac.uk
Subject: Re: [EP-tech] technical question: one archive with two domains

Hey John,
thanks for your answer. Bad ideas are usually the best ;)
It would be great if you could explain your suggestion a little bit more, I don't really get what you mean.
Thank you very much,
best regards
Thorsten Buelo
University of Cologne
Institut fuer Informatik
www.informatik.uni-koeln.de<http://www.informatik.uni-koeln.de>


Message: 2
Date: Thu, 9 Mar 2017 12:25:57 +0000
From: John Salter <J.Salter at leeds.ac.uk<mailto:J.Salter at leeds.ac.uk>>
Subject: Re: [EP-tech] technical question: one archive with two
        domains
To: "eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>" <eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>>
Message-ID:
        <DB6PR0301MB231148AA2260DA554C9DA03DC4210 at DB6PR0301MB2311.eurprd03.prod.outlook.com<mailto:DB6PR0301MB231148AA2260DA554C9DA03DC4210 at DB6PR0301MB2311.eurprd03.prod.outlook.com>>

Content-Type: text/plain; charset="utf-8"

Hi,
This might be a really bad idea (but it might be genius)?

Could you output a <base href="?"/> tag (using the dynamic template system), *and* make sure all links are relative?

Cheers,
John

From: eprints-tech-bounces at ecs.soton.ac.uk<mailto:eprints-tech-bounces at ecs.soton.ac.uk> [mailto:eprints-tech-bounces at ecs.soton.ac.uk<mailto:eprints-tech-bounces at ecs.soton.ac.uk>] On Behalf Of Thorsten B?lo
Sent: 09 March 2017 12:10
To: eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>
Subject: [EP-tech] technical question: one archive with two domains

Hey there,
I'm still trying to configure my eprints archive to work with two domains. I tried all your suggestions (except mod_substitute) in different ways, but it still don't work.
My goal: I want to access one archive using two different domains. So I modified the apache-includes to add a ServerAlias, this part works fine: domain1 and domain2 show the exact same website. My problem: It is the EXACT same website, so all links are the same, too. So if i use one of the links on domain2, I go to domain1 and do not remain on domain2.
Do you have any more ideas why this could happen and how to avoid it?
On my way finding a solution, I tried to modify the html-snippets used to build the website - this worked for some parts, but changing other parts killed the whole site. My idea was to change all links manually (if it was working, i would automate this with a little script). Do anybody know the part/script of eprints which combines the html snippets? I hope that reading this script might help me to modify my repo.
Thany you again for your help,
best regards
Thorsten Buelo
University of Cologne
Institut fuer Informatik
www.informatik.uni-koeln.de<http://www.informatik.uni-koeln.de><http://www.informatik.uni-koeln.de>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20170309/40f1ac9a/attachment-0001.html