Support X-Forwarded-Proto header
modules/pastebin/httpserver.scm
| 66 | 66 | (title ,title) | |
| 67 | 67 | (meta (@ (charset "utf-8"))) | |
| 68 | 68 | (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))) | |
| 69 | - | (link (@ (rel "stylesheet") (href "https://unpkg.com/simpledotcss/simple.min.css")))) | |
| 69 | + | (link (@ (rel "stylesheet") (href "https://cdn.simplecss.org/simple.min.css")))) | |
| 70 | 70 | (body ,@body))) | |
| 71 | 71 | ||
| 72 | 72 | (define (list-handler pb-data-path) | |
… | |||
| 92 | 92 | (form (@ (method "post") | |
| 93 | 93 | (enctype "multipart/form-data") | |
| 94 | 94 | (action "/post")) | |
| 95 | - | (p (label "Paste content" | |
| 96 | - | (textarea (@ (name "text")) ""))) | |
| 97 | - | (p (label (input (@ (type "checkbox") | |
| 98 | - | (name "showUrl") | |
| 99 | - | (value "1"))) | |
| 100 | - | "Show raw URL after paste")) | |
| 101 | - | (input (@ (type "submit")))))) | |
| 95 | + | (fieldset (label (@ (for "form-text")) | |
| 96 | + | "Paste content") | |
| 97 | + | (textarea (@ (id "form-text") | |
| 98 | + | (name "text")) "") | |
| 99 | + | (label (@ (for "form-showurl")) | |
| 100 | + | (input (@ (type "checkbox") | |
| 101 | + | (id "form-showurl") | |
| 102 | + | (name "showUrl") | |
| 103 | + | (value "1"))) | |
| 104 | + | "Show raw URL after paste") | |
| 105 | + | (input (@ (type "submit") | |
| 106 | + | (value "Submit"))))))) | |
| 102 | 107 | (footer (p (a (@ (href "https://github.com/pisemsky/guile-pastebin") | |
| 103 | 108 | (target "_blank")) | |
| 104 | 109 | "Source code"))))))) | |
… | |||
| 136 | 141 | #:code 200 | |
| 137 | 142 | #:headers '((content-type . (text/plain)))) | |
| 138 | 143 | (lambda (port) | |
| 139 | - | (let* ((hostp (assq-ref headers 'host))) | |
| 144 | + | (let* ((hostp (assq-ref headers 'host)) | |
| 145 | + | (proto (assq-ref headers 'x-forwarded-proto))) | |
| 140 | 146 | (put-string | |
| 141 | 147 | port | |
| 142 | 148 | (uri->string | |
| 143 | - | (build-uri 'http | |
| 149 | + | (build-uri (if (equal? proto "https") 'https 'http) | |
| 144 | 150 | #:host (car hostp) | |
| 145 | 151 | #:port (cdr hostp) | |
| 146 | 152 | #:path (format #f "/raw/~a\r\n" | |