[opencms-dev] Creating internal links in ADE does not work as expected, always puts server name in link - login to Workplace directly from site

Jan Michael Greiner jan0michael at yahoo.com
Sun Jan 2 20:28:12 CET 2022


Dear all,


I tried to copy the code for frontendlogin.jsp mentioned on

http://www.opencms-wiki.org/wiki/Custom_Login_Page

to /sites/domain1/login.jsp.

In the code I changed line 19 from

cmsObject.getRequestContext().setSiteRoot("/sites/default/");

to

cmsObject.getRequestContext().setSiteRoot("/sites/domain1/");

and I changed line 46 from

<form method="post" action="<%=cms.info("opencms.url")%>">

to

<form method="post" action="login.jsp">


Login with https://domain1.de/opencms/login.jsp works, but I get a message:

Accessing workplace or ADE through a server which has not been configured. Your site configuration is probably incorrect.

Can anyone help me with that?
What am I doing wrong?

I just duckduckgo.com'ed the message "Accessing workplace or ADE through a server which has not been configured. Your site configuration is probably incorrect."
I found

https://github.com/alkacon/opencms-docker/issues/7

Alexander Kandzior (aKandzior) from Alkacon writes

"The workplace server is apparently not accessed through the configured ip address or server name. This is ignored as long as there is only one site configured. As soon as there is more than one site configured, all access to the workplace must be using the configured workplace server url."

If that is true, I should not try to create a Workplace login for my domain1.de... and this is not the solution to go, to solve the "relative link problem" (see my first e-mail on the subject, see below). :-(


(I see as solution, doing separate OpenCms installations for my domain1 and domain2... But I would not like to maintain different OpenCms installations for different websites. And I am sure, there will be a better solution for the "relative link problem" :-)   )


Best regards,

Jan Michael Greiner



 --------------------------
On Sunday, January 2, 2022, 09:05:21 AM GMT+1, Jan Michael Greiner <jan0michael at yahoo.com> wrote: 

Dear all,


I found out, if I edit the controlcode, and change the link (from the mentioned example) from

<target><![CDATA[/sites/default/technologien/]]></target>

to

<target><![CDATA[/technologien/]]></target>

the file is saved with

<target><![CDATA[/sites/domain1/technologien/]]></target>

(The edit control code function does some content changing in the background, when saving.)



The domain1 makes browsing the website with https://domain1.de and https://www.domain1.de work as expected.
So it still is not a relative link, but works like it should.
So making the workplace accessible through https://domain1.de would be an option.
How can I achieve that?
I tried to copy /sites/default/login/index.html to /sites/domain1, but that just gives an empty template page, and there still is no login function.


Best regards,

Jan Michael Greiner


---------

On Sunday, January 2, 2022, 08:43:25 AM GMT+1, Jan Michael Greiner <jan0michael at yahoo.com> wrote: 

Dear all,


In my OpenCms 12 installation I have the following Domains (names changed) configured on my reverse proxy:

cms.domain1.de, forwarded to real server https://opencms-workplace:8443

www.domain1.de, forwarded to real server https://opencms-domain1:8443

domain1.de, forwarded to real server https://opencms-domain1:8443

www.domain2.de, forwarded to real server https://opencms-domain2:8443

domain2.de, forwarded to real server https://opencms-domain2:8443

www.domain2.com, forwarded to real server https://opencms-domain2:8443

domain2.com, forwarded to real server https://opencms-domain2:8443


On the internal/real opencms server I have configured in the site management (Launchpad - Websites):

/sites/default
Server URL: https://cms.domain1.de, Alias: https://opencms-workplace:8443

/sites/domain1
Server URL: https://domain1.de, Aliases: https://opencms-domain1:8443, https://www.domain1.de

/sites/domain2
Server URL: https://domain2.de, Aliases: https://opencms-domain2:8443, https://www.domain2.de, https://domain2.com, https://www.domain2.com


Problem:
I access the Workplace (and advanced direct edit - ADE) through https://cms.domain1.de.
If I try to create an internal link in ADE for the domain1 website, there is always an absolute link created, including the server name. When I create the link, everything looks fine - like if a relative link is created - see attached screenshot create_link.png.

But then, if I look with "Edit controlcode" in the created content file, there is
<target><![CDATA[/sites/default/technologien/]]></target>
And when I browse the website, the link is always shown as
https://cms.domain1.de/opencms/technologien
instead as it should, as relative link, with just "technologien" (or changed by the <cms:link> internal mechanism as "/opencms/technologien").

Of cource cms.domain1.de does not serve the website of domain1 (unless for users that are logged in in the Workplace, and have selected /sites/domain1 as their current site, I think - what is not the case for external website visitors).


As a workaround, I can edit the controlcode of the content file and change /sites/default/technologien/ to just /technologien/.
But that is not how I expect OpenCms to work :-)

What am I doing wrong?


I was thinking about adding the login function for the Workplace to domain1. But then the links would probably be https://domain1.de. And I do not want users browsing https://www.domain1.de to be switched to https://domain1.de, by clicking a website internal link. So I think that would not be a perfect solution.
I just want relative links, not absolute links.

Could the problem be related to this question:

https://webmail.opencms.org/pipermail/opencms-dev/2019q4/042537.html

?


Best regards, and a happy new year!

Jan Michael Greiner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: create_link.png
Type: image/png
Size: 12920 bytes
Desc: not available
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20220102/69424484/attachment.png>


More information about the opencms-dev mailing list