cas.server.prefix being ignored

247 views
Skip to first unread message

Agustín Ezequiel Pereyra

unread,
Feb 15, 2022, 9:55:46 PM2/15/22
to CAS Community
Hello,

I want to deploy cas so it takes requests at http://myUrl.com/ instead of the default http://myUrl.com/cas.

According to the documentation, and this thread: https://groups.google.com/a/apereo.org/g/cas-user/c/ntVu5_b7TT8/m/wh3IL3qQCQAJ, setting the properties:
                    
                    cas.server.prefix=${cas.server.name}/
                    server.contextPath=/

Should be enough (if I got it wright). Yet I can't make it work. I'm testing with the basic cas-overlay, version 6.4.2. The only thing I customized is the cas.properties file, with the following lines:

                cas.server.name=http://myUrl.com:8080
                cas.server.prefix=${cas.server.name}
                server.contextPath=/
                server.port=8080
                server.ssl.enabled=false

When I navigate to http://myUrl.com:8080/login I get a 404 error. But when I go to http://myUrl.com:8080/cas/login, I do get the login page. Do you know what I may be doing wrong?

Petr Fišer

unread,
Feb 16, 2022, 2:19:32 AM2/16/22
to cas-...@apereo.org
Hello,
This looks like you are deploying CAS to your own app container.
It will not work, because "server.xxxxxxx" properties are made for configuring a tomcat container embedded in the war.

Cheers,
Fiisch
--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/a18e9b2f-da86-49d2-8247-b5731b6445cbn%40apereo.org.

Agustín Ezequiel Pereyra

unread,
Feb 16, 2022, 7:02:50 AM2/16/22
to cas-...@apereo.org
Hello Fiisch, thank you very much for your answer. I am deploying CAS with the embedded Tomcat, not another container. Should it work in this case?  Do you have any clue what else I could be missing?

Regards,

Petr Fišer

unread,
Feb 16, 2022, 8:27:42 AM2/16/22
to CAS Community, Agustín Ezequiel Pereyra
Hello,
I have no experience with embedded tomcat, sorry. I always used a standalone container.
One thing in your config stands out, though.

You use:

cas.server.prefix=${cas.server.name}

But linked discussion mentions:

cas.server.prefix=${cas.server.name}/

with the / at the end of server prefix.

Fiisch


Dne středa 16. února 2022 v 13:02:50 UTC+1 uživatel Agustín Ezequiel Pereyra napsal:

Julien Weillaert

unread,
Aug 11, 2023, 1:18:59 PM8/11/23
to CAS Community, petr.f...@gmail.com, Agustín Ezequiel Pereyra
I was getting a lot of trouble with this also.
The cas.server.prefix is totally useless and does not modify the url like you want.
The parameter to use is : 

server.servlet.context-path=/

And then, it works perfectly !

Petr Bodnár

unread,
Aug 12, 2023, 7:59:48 AM8/12/23
to CAS Community, weillaer...@gmail.com, petr.f...@gmail.com, Agustín Ezequiel Pereyra
Hi all,

this one was fun to investigate. :) Here are my findings on this topic, hopefully they can clarify it a bit:

It looks like that CAS, already in version 6.1.0-RC5, switched to Spring Boot 2 (see here), which means most of those "server.*" property names had to be changed to "server.servlet.*". This also includes using the "server.servlet.context-path" property - which is confirmed by CAS archived docs (available here for the actual 6.6.x version).

That said, it remains a bit mystery why in the linked thread https://groups.google.com/a/apereo.org/g/cas-user/c/ntVu5_b7TT8/m/wh3IL3qQCQAJ, they say "server.contextPath" did work for them with CAS 6.1, when it apparently shouldn't have. Maybe they used a pre-release version, or forgot to notice the difference...

Regarding the "cas.server.prefix", I think we all agree that this property could surely be documented more (currently "A concatenation of the server name plus the CAS context path. Deployments at root likely need to blank out this value." -> not quite accurate and purpose of the property is also left out). But well, as authors would probably say, PRs are welcome... :)

Petr
Reply all
Reply to author
Forward
0 new messages