git.fiddlerwoaroof.com
Browse code

Begin to work on proper proxy ip handling - - - perhaps this should just be left up to nginx?

E L authored on 29/01/2016 05:37:40
Showing 2 changed files
... ...
@@ -69,9 +69,19 @@
69 69
   (remove-if (lambda (x) (not (equal x "approved"))) feeds :key #'s-approved))
70 70
 
71 71
 (defparameter *app* (make-instance 'ningle:<app>))
72
-(defmethod lack.component:call :before ((component (eql *app*)) env)
73
-  (awhen (gethash "x-remote-ip" (lack.request:request-headers ningle.context:*request*))
74
-    (setf (lack.request:request-remote-addr ningle:*request*) it)))
72
+
73
+(defun rebind-headers (app)
74
+  (lambda (env)
75
+    (format t "~&~%------------------@!@#$@#!$!@#$-----------------~%")
76
+    (format t "~&~%~s"   ningle.context:*request*)
77
+    (format t "~&~s~%" (alexandria:hash-table-alist (lack.request:request-headers ningle.context:*request*)))
78
+    (format t "~&~s~%~%" (gethash "x-real-ip" (lack.request:request-headers ningle.context:*request*)))
79
+    (awhen (gethash "x-real-ip" (lack.request:request-headers ningle.context:*request*))
80
+      (format t "~&~s"   (lack.request:request-remote-addr ningle.context:*request*))  
81
+      (setf (lack.request:request-remote-addr ningle:*request*) it)
82
+      (setf (getf env :remote-addr) it)
83
+      (format t "~&~s"   (lack.request:request-remote-addr ningle.context:*request*)))
84
+    (funcall app env)))
75 85
 
76 86
 (defmacro i-defun (name (&rest args) &body body)
77 87
   `(defun ,name (,@args)
... ...
@@ -267,9 +277,9 @@
267 277
               (funcall clack-errors:*clack-error-middleware*
268 278
                        (lack.builder:builder
269 279
                          :accesslog
270
-                         :session
271 280
                          (:static :path "/static/" :root #p"./static/")
272 281
                          :backtrace
282
+                         :session
273 283
                          *app*
274 284
                          )
275 285
                       :debug (ubiquitous:defaulted-value t 'debug))
... ...
@@ -1,7 +1,7 @@
1 1
 <!DOCTYPE html>
2 2
 <html lang="en">
3 3
   <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# join-marrow: http://ogp.me/ns/fb/join-marrow#">
4
-    <base href="http://planet.joinmarrow.com" />
4
+    <base href="https://planet.joinmarrow.com/" />
5 5
     <meta property="og:type" content="join-marrow:headlines" />
6 6
     <meta property="og:title" content="Current Headlines" />
7 7
     <meta property="og:site_name" content="Catholic News" />