Commit 15fdd928 authored by Sebastien Chopin's avatar Sebastien Chopin

Fix https + canonical link

parent 0f13c380
...@@ -19,6 +19,18 @@ ...@@ -19,6 +19,18 @@
</div> </div>
</template> </template>
<script>
export default {
head() {
return {
link: [
{ rel: 'canonical', href: `https://hn.nuxtjs.org${this.$route.fullPath}` }
]
}
}
}
</script>
<style lang="stylus"> <style lang="stylus">
body body
font-family -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-family -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
......
export default ({ isDev, req, redirect }) => { export default ({ isDev, req, redirect }) => {
// Redirect to https // Redirect to https
if (!isDev && req && !req.connection.encrypted) { if (!isDev && req) {
const protocol = req.headers['X-Forwarded-Proto'] || (req.connection.encrypted ? 'https' : 'http')
if (protocol === 'http') {
return redirect(301, `https://${req.headers.host}${req.url}`) return redirect(301, `https://${req.headers.host}${req.url}`)
} }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment