Add headers to allow Discord iframe embedding
cgen-2b1ba4a135b64d0b862ed3289277fdb6
This commit is contained in:
parent
48ba286e7b
commit
80cc9a5fe5
1 changed files with 11 additions and 0 deletions
|
|
@ -93,6 +93,17 @@ export function createServer() {
|
|||
// Middleware
|
||||
app.use(cors());
|
||||
|
||||
// Allow Discord to embed the activity in iframes
|
||||
app.use((req, res, next) => {
|
||||
// Allow embedding in iframes (Discord Activities need this)
|
||||
res.setHeader("X-Frame-Options", "ALLOWALL");
|
||||
// Allow Discord to access the iframe
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
||||
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, x-signature-ed25519, x-signature-timestamp");
|
||||
next();
|
||||
});
|
||||
|
||||
// Discord endpoint needs raw body for signature verification
|
||||
app.post(
|
||||
"/api/discord/interactions",
|
||||
|
|
|
|||
Loading…
Reference in a new issue