diff --git a/flowspec/views.py b/flowspec/views.py
index 3680fdf5fb369cfd858efeac918f5d125eb99d8e..bdf652a294fd915a12b126dfda9350bd5b4a4eef 100644
--- a/flowspec/views.py
+++ b/flowspec/views.py
@@ -277,8 +277,10 @@ def add_route(request):
         if not request.user.is_superuser:
             form.fields['then'] = forms.ModelMultipleChoiceField(queryset=ThenAction.objects.filter(action__in=settings.UI_USER_THEN_ACTIONS).order_by('action'), required=True)
             form.fields['protocol'] = forms.ModelMultipleChoiceField(queryset=MatchProtocol.objects.filter(protocol__in=settings.UI_USER_PROTOCOLS).order_by('protocol'), required=False)
-        return render_to_response('apply.html', {'form': form, 'applier': applier},
-                                  context_instance=RequestContext(request))
+        return render_to_response('apply.html', {'form': form,
+            'applier': applier,
+            'maxexpires': settings.MAX_RULE_EXPIRE_DAYS },
+            context_instance=RequestContext(request))
 
     else:
         request_data = request.POST.copy()
@@ -319,8 +321,8 @@ def add_route(request):
                 'apply.html',
                 {
                     'form': form,
-                    'applier': applier
-
+                    'applier': applier,
+                    'maxexpires': settings.MAX_RULE_EXPIRE_DAYS
                 }
             )
 
@@ -401,7 +403,8 @@ def edit_route(request, route_slug):
                 {
                     'form': form,
                     'edit': True,
-                    'applier': applier
+                    'applier': applier,
+                    'maxexpires': settings.MAX_RULE_EXPIRE_DAYS
                 },
                 context_instance=RequestContext(request)
             )
@@ -425,7 +428,8 @@ def edit_route(request, route_slug):
             {
                 'form': form,
                 'edit': True,
-                'applier': applier
+                'applier': applier,
+                'maxexpires': settings.MAX_RULE_EXPIRE_DAYS
             },
             context_instance=RequestContext(request)
         )
diff --git a/flowspy/settings.py.dist b/flowspy/settings.py.dist
index bfc060e203578d71da299724b056d03296ae3fe3..27b658207caabab7e55cefe42d3fd4ca405e803d 100644
--- a/flowspy/settings.py.dist
+++ b/flowspy/settings.py.dist
@@ -273,6 +273,8 @@ CELERY_IMPORTS = ("flowspec.tasks", )
 SERVER_EMAIL = "Example FoD Service <noreply@example.com>"
 EMAIL_SUBJECT_PREFIX = "[FoD] "
 EXPIRATION_NOTIFY_DAYS = 4
+# max number of days into the future that is allowed to pick in rule expiration datepicker
+MAX_RULE_EXPIRE_DAYS = 30
 PREFIX_LENGTH = 29
 
 # Shibboleth
diff --git a/templates/apply.html b/templates/apply.html
index 91cb7d36ac4bf0756668fd7713b0745568adfe9a..74d341bbd376649252eaaef8cb500eed417cdb58 100644
--- a/templates/apply.html
+++ b/templates/apply.html
@@ -94,7 +94,7 @@
 
 		$('#id_expires').datepicker({
 			startDate: '+1d',
-			endDate: '+10d'
+			endDate: '+{{maxexpires}}d'
 		});
 		$('#setFromAll').click(function(){
 			$("#id_source").val('0.0.0.0/0');