Skip to content

Commit

Permalink
Add angular redirect for links
Browse files Browse the repository at this point in the history
 - Fixes 404 errors for kakwa redirects
 - Links to same domain (eg: avalanche.ca) use client side routing so
   nginx redirects dont apply. Added kakwa reriect mirror to make blog
   links work
  • Loading branch information
Will Harding committed Jan 7, 2016
1 parent f0e04ea commit 66eb923
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions client/app/avalanchecanada/redirect/redirect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

'use strict';

angular.module('avalancheCanadaApp')
.config(function ($stateProvider) {
$stateProvider
.state('ac.redirectKakwa', {
url: '^/kakwa',
controller: function($window) {
$window.location.href = 'http://www.yukonavalanche.ca/wx/weatherCAC.php?station=CACKAK';
}
});
});
1 change: 1 addition & 0 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<script src="app/avalanchecanada/news/news.controller.js"></script>
<script src="app/avalanchecanada/news/news.js"></script>
<script src="app/avalanchecanada/news/newsItem.controller.js"></script>
<script src="app/avalanchecanada/redirect/redirect.js"></script>
<script src="app/avalanchecanada/sponsors/sponsors.js"></script>
<script src="app/avalanchecanada/submit/submit.controller.js"></script>
<script src="app/avalanchecanada/submit/submit.js"></script>
Expand Down
5 changes: 5 additions & 0 deletions proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ server {
}

location /cherry-bowl {
rewrite /cherry-bowl/$ /index.html break;
rewrite /cherry-bowl$ /index.html break;
rewrite /cherry-bowl/(.*) /$1 break;
proxy_pass https://cherry-bowl.s3.amazonaws.com;
}
Expand All @@ -42,6 +44,9 @@ server {
location /caf{
return 301 http://www.avalanche.ca/foundation;
}
location /kakwa{
return 301 http://www.yukonavalanche.ca/wx/weatherCAC.php?station=CACKAK;
}

location /cac/about/(media|careers){
return 410;
Expand Down

0 comments on commit 66eb923

Please sign in to comment.