Showing 3 changed files with 25 additions and 4 deletions
+1
CHANGES
... ...
@@ -2,6 +2,7 @@
2 2
   - drop Perl 5.8 support, now require Perl 5.10.1
3 3
   - use own temparaly directory when creating repositoy with readme file. Now not use /tmp.
4 4
   - add Mojolicious::Plugin::DBViewer to cpanfile
5
+  - X-Forwarded-HTTPS header is DEPRECATED! use X-Forwarded-Proto header instead.
5 6
 1.12 (7 Feb 2016)
6 7
   - Catch up latest Github design.
7 8
   - Fix bug that relative image path in README.md and blob html.
+14 -4
README.md
... ...
@@ -253,7 +253,7 @@ You can use Name virtual host.
253 253
       ProxyPreserveHost On
254 254
       ProxyPass / http://localhost:10020/ keepalive=On
255 255
       ProxyPassReverse / http://localhost:10020/
256
-      RequestHeader set X-Forwarded-HTTPS "0"
256
+      RequestHeader set X-Forwarded-Proto "https"
257 257
         
258 258
     </VirtualHost>
259 259
 
... ...
@@ -272,7 +272,7 @@ If you use GitPrep vis https, you should set X-Forwarded-HTTPS Request Header.
272 272
       ProxyPreserveHost On
273 273
       ProxyPass / http://localhost:10020/ keepalive=On
274 274
       ProxyPassReverse / http://localhost:10020/
275
-      RequestHeader set X-Forwarded-HTTPS "1"
275
+      RequestHeader set X-Forwarded-Proto "https"
276 276
     </VirtualHost>
277 277
 
278 278
 ### How to use reverse proxy with sub directory?
... ...
@@ -304,8 +304,8 @@ Next you set http server config file. The following is apache example.
304 304
 
305 305
       ProxyPass /app2 http://localhost:10021/app2 keepalive=On
306 306
       ProxyPassReverse /app2 http://localhost:3001/app2
307
-
308
-      RequestHeader set X-Forwarded-HTTPS "0"
307
+      
308
+      RequestHeader set X-Forwarded-Proto "https"
309 309
     </VirtualHost>
310 310
 
311 311
 ### How to import already existing repositories?
... ...
@@ -440,6 +440,16 @@ perlbrew is very useful perl installation tools without breaking your system per
440 440
 
441 441
 If you install perl 5.10.1+ by perlbrew, you can install latest GitPrep.
442 442
 
443
+### I know information about GitPrep 2.0 upgrading.
444
+
445
+1. X-Forwarded-HTTPS header is deprecated. use  X-Forwarded-Proto header.
446
+    
447
+    # This is deprecated in GitPrep 2.0
448
+    RequestHeader set X-Forwarded-HTTPS "1"
449
+    
450
+    # Use X-Forwarded-Proto instead
451
+    RequestHeader set X-Forwarded-Proto "https"
452
+
443 453
 ## For Developer
444 454
 
445 455
 If you are a developer, you can start the application in development mode.
+10
lib/Gitprep.pm
... ...
@@ -403,6 +403,16 @@ sub startup {
403 403
     $self->helper(gitprep_api => sub { Gitprep::API->new(shift) });
404 404
   }
405 405
   
406
+  # set scheme to https when X-Forwarded-HTTPS header is specified
407
+  # This is for the backword compatible only. Now X-Forwarded-Proto is used for this purpose
408
+  $self->hook(before_dispatch => sub {
409
+    my $c = shift;
410
+    if ($c->req->headers->header('X-Forwarded-HTTPS')) {
411
+      $c->req->url->base->scheme('https');
412
+      $c->app->log->warn("X-Forwarded-HTTPS header is DEPRECATED! use X-Forwarded-Proto instead.");
413
+    }
414
+  });
415
+  
406 416
   # Reverse proxy support
407 417
   my $reverse_proxy_on = $self->config->{reverse_proxy}{on};
408 418
   my $path_depth = $self->config->{reverse_proxy}{path_depth};