diff --git a/cas/cas-server/src/main/java/fr/gouv/vitamui/cas/webflow/actions/CustomDelegatedClientAuthenticationAction.java b/cas/cas-server/src/main/java/fr/gouv/vitamui/cas/webflow/actions/CustomDelegatedClientAuthenticationAction.java
index 28a8cbc693f2e147387e2e0898464836385fe82a..987eeb6ae3f65863d06d764eb4a55e738b3f6ac6 100644
--- a/cas/cas-server/src/main/java/fr/gouv/vitamui/cas/webflow/actions/CustomDelegatedClientAuthenticationAction.java
+++ b/cas/cas-server/src/main/java/fr/gouv/vitamui/cas/webflow/actions/CustomDelegatedClientAuthenticationAction.java
@@ -140,6 +140,12 @@ public class CustomDelegatedClientAuthenticationAction extends DelegatedClientAu
         val flowScope = context.getFlowScope();
         flowScope.put(Constants.PORTAL_URL, vitamuiPortalUrl);
 
+        // retrieve the service if it exists to prepare the serviceUrl parameter (for the back links)
+        val service = WebUtils.getService(context);
+        if (service != null) {
+            flowScope.put("serviceUrl", service.getOriginalUrl());
+        }
+
         val event = super.doExecute(context);
         if ("error".equals(event.getId())) {
 
diff --git a/cas/cas-server/src/main/resources/templates/casLoginView.html b/cas/cas-server/src/main/resources/templates/casLoginView.html
index a2a468e801bd6b5c00028585dccabc8e749f932f..5c9d6e5422f163120af54f3fd5aae0639f99ef61 100644
--- a/cas/cas-server/src/main/resources/templates/casLoginView.html
+++ b/cas/cas-server/src/main/resources/templates/casLoginView.html
@@ -110,7 +110,7 @@
             <button type="submit" class="vitamui-primary" name="submit" accesskey="l" th:value="Suivant" tabindex="6">OK</button>
         </form>
         <p class="helper">Appuyez sur <strong>Entrée</strong> pour valider</p>
-		<button class="back" type="button" th:onclick="|location.href = '@{/login}';|" th:if="${!#strings.isEmpty(superUser)}">
+		<button class="back" type="button" th:onclick="|location.href = '@{/login(service=${serviceUrl})}';|" th:if="${!#strings.isEmpty(superUser)}">
 			<i class="material-icons">arrow_back</i> Retour
 	    </button>
     </div>
diff --git a/cas/cas-server/src/main/resources/templates/casPwdView.html b/cas/cas-server/src/main/resources/templates/casPwdView.html
index 3e02c27a8ee6c2b00276446ad3e8dfab4035178d..e65cf6f890aa8d6db0250fdb675bd0339382fd43 100644
--- a/cas/cas-server/src/main/resources/templates/casPwdView.html
+++ b/cas/cas-server/src/main/resources/templates/casPwdView.html
@@ -96,7 +96,7 @@
             </button>
         </form>
 
-		<button class="back" type="button" th:onclick="|location.href = '@{/login}';|">
+		<button class="back" type="button" th:onclick="|location.href = '@{/login(service=${serviceUrl})}';|">
 			<i class="material-icons">arrow_back</i> Retour
 	    </button>
     </div>
diff --git a/cas/cas-server/src/main/resources/templates/layout.html b/cas/cas-server/src/main/resources/templates/layout.html
index 8606b2fd02f1887619c0d4dc6ff58d56e77ead6e..5f759a0e14cf9918da58d66190377ef18c89bd45 100644
--- a/cas/cas-server/src/main/resources/templates/layout.html
+++ b/cas/cas-server/src/main/resources/templates/layout.html
@@ -59,7 +59,7 @@
         	<p/>
     	</div>
 
-		<button class="back" type="button" th:onclick="|location.href = '@{/login}';|">
+		<button class="back" type="button" th:onclick="|location.href = '@{/login(service=${serviceUrl})}';|">
         	<i class="material-icons">arrow_back</i> Retour
         </button>
     </div>