Skip to content

Commit 796828d

Browse files
authored
b/68251551: Send headers via URL Param to avoid CORS preflight round-trip. (#322)
Send headers via URL Param to avoid CORS preflight round-trip.
1 parent 7db74e6 commit 796828d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/firestore/src/platform_browser/webchannel_connection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ export class WebChannelConnection implements Connection {
203203
// parameter.
204204
httpSessionIdParam: 'gsessionid',
205205
initMessageHeaders: {},
206+
// Send our custom headers as a '$httpHeaders=' url param to avoid CORS
207+
// preflight round-trip. This is formally defined here:
208+
// https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L40
209+
httpHeadersOverwriteParam: '$httpHeaders',
206210
sendRawJson: true,
207211
supportsCrossDomainXhr: true
208212
};

0 commit comments

Comments
 (0)