Skip to content

Commit 391dbc5

Browse files
committed
ensure content type is set correctly in server
1 parent a36295a commit 391dbc5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: server/server.js

+21
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,27 @@ if (process.env.BASIC_USERNAME && process.env.BASIC_PASSWORD) {
125125
);
126126
}
127127

128+
// routing to serve files in .well-known with specific content type
129+
// temporary addition for the apple pay integration with donorbox
130+
app.use(
131+
'/.well-known/apple-developer-merchantid-domain-association',
132+
(req, res, next) => {
133+
const filePath = path.join(
134+
__dirname,
135+
'../public/.well-known/apple-developer-merchantid-domain-association'
136+
);
137+
138+
res.setHeader('Content-Type', 'text/plain');
139+
140+
res.sendFile(filePath, (err) => {
141+
if (err) {
142+
console.error('Error serving file:', err);
143+
next(err);
144+
}
145+
});
146+
}
147+
);
148+
128149
// Body parser, cookie parser, sessions, serve public assets
129150
app.use(
130151
'/locales',

0 commit comments

Comments
 (0)