Slackのリンクプレビューは
掲題の通り、自分のメモ書きとして残す。
やったこと
firebaseに対して以下の様なアプリを立てた
const functions = require('firebase-functions'); const express = require('express'); const app = express(); app.get('/redirect', (req, res) => { res.location('https://requestbin.fullcontact.com/******61?from=redirect') res.send(301, null); }) app.get('/href', (req, res) => { res.setHeader('Content-type', 'text/html') res.write( `<h1>Location.href</h1> <script>location.href="https://requestbin.fullcontact.com/******61?from=href"</script>` ) res.send(200); }) exports.app = functions.https.onRequest(app);
/redirect
にアクセスがあればLocation:https://requestbin.fullcontact.com/******61?from=redirect
を付与してリダイレクト/href
にアクセスがあればlocation.href="https://requestbin.fullcontact.com/******61?from=href"
でリダイレクト
Slackにリンクを貼り付けてリンクプレビューを取得させた。
結果
Location:
ヘッダの方はリダイレクトした。