{"action":"closed","issue":{"url":"https://api.github.com/repos/kobotoolbox/enketo-express/issues/182","labels_url":"https://api.github.com/repos/kobotoolbox/enketo-express/issues/182/labels{/name}","comments_url":"https://api.github.com/repos/kobotoolbox/enketo-express/issues/182/comments","events_url":"https://api.github.com/repos/kobotoolbox/enketo-express/issues/182/events","html_url":"https://github.com/kobotoolbox/enketo-express/issues/182","id":66865917,"number":182,"title":"protocol in API response incorrect when reverse proxy used","user":{"login":"ivermac","id":1128227,"avatar_url":"https://avatars.githubusercontent.com/u/1128227?v=3","gravatar_id":"","url":"https://api.github.com/users/ivermac","html_url":"https://github.com/ivermac","followers_url":"https://api.github.com/users/ivermac/followers","following_url":"https://api.github.com/users/ivermac/following{/other_user}","gists_url":"https://api.github.com/users/ivermac/gists{/gist_id}","starred_url":"https://api.github.com/users/ivermac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivermac/subscriptions","organizations_url":"https://api.github.com/users/ivermac/orgs","repos_url":"https://api.github.com/users/ivermac/repos","events_url":"https://api.github.com/users/ivermac/events{/privacy}","received_events_url":"https://api.github.com/users/ivermac/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kobotoolbox/enketo-express/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/kobotoolbox/enketo-express/labels/KoBo","name":"KoBo","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-07T11:58:27Z","updated_at":"2015-04-09T15:59:04Z","closed_at":"2015-04-09T15:59:04Z","body":"This is more of a question than an issue. We are hosting enketo express which can be accessed via a url whose protocol is `https`. The server url also has a `https` protocol. I tried generating a preview url based on [enketo api docs] (http://apidocs.enketo.org/#/get-preview-survey) and I was able to generate the preview url but the protocol of the preview url was `http` instead of `https`. The quick fix we used was to replace [this line] (https://github.com/kobotoolbox/enketo-express/blob/master/app/controllers/api-v2-controller.js#L280) with the snippet below?\r\n```javascsript\r\n...\r\n        protocol = (req.app.get( 'linked form and data server' ).authentication[ 'allow insecure transport' ]) ? req.protocol : \"https\",\r\n        baseUrl = protocol + '://' + req.headers.host + '/',\r\n```\r\nDoes this make sense or might it be something we are doing wrong on our end?"}}