Skip to content

Commit

Permalink
fix: fix the issue that netlify auto preserves existing query strings
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyli committed Jul 6, 2022
1 parent 85c49ca commit 546959e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion functions/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ exports.handler = function(event, context, callback) {
})
});
} else {
// Adding a query string of "?a=a" is to work around the issue that netlify auto preserves existing
// event.queryStringParameters in the next redirect url even though this is not desired. The work
// around is to add another parameter.
// See https://answers.netlify.com/t/redirect-doesnt-remove-query-params/31548/9
const redirectUrl = refererUrl + "?a=a";
console.log("=== redirectUrl: ", redirectUrl);
return callback(null, {
statusCode: 302,
headers: {
Expand Down

0 comments on commit 546959e

Please sign in to comment.