← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20830: Fix origin header issue relating to localUrl and Path

 

------------------------------------------------------------
revno: 20830
committer: Mark Polak <markpo@xxxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-10-21 17:05:41 +0200
message:
  Fix origin header issue relating to localUrl and Path
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java	2015-10-21 11:33:29 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java	2015-10-21 15:05:41 +0000
@@ -136,7 +136,7 @@
 
         if ( StringUtils.isEmpty( forwardedProto ) )
         {
-            localUrl = ServletUriComponentsBuilder.fromContextPath( request ).build().toUriString();
+            localUrl = ServletUriComponentsBuilder.fromContextPath( request ).replacePath("").build().toUriString();
         }
         else
         {
@@ -144,7 +144,7 @@
                 .scheme( forwardedProto ).build().toUriString();
         }
 
-        return !StringUtils.isEmpty( origin ) && ( localUrl.equals( origin ) || 
+        return !StringUtils.isEmpty( origin ) && ( localUrl.equals( origin ) ||
             configurationService.getCorsWhitelist().contains( origin ) );
     }