-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set default user agent #282
base: master
Are you sure you want to change the base?
Conversation
I am sorry, I could not find test cases. So, I didn't start anything new for the same |
Hi mate. I believe you want to add the addition of a HTTP header "User-Agent" to the request options. You can leave the AGENT stuff alone (that is for something else, reusing TLS connections but issue #264 is different) |
So add standard http header "User-Agent" with value "authorization-at-edge" or so to the |
I'm sorry. I misunderstood the issue. Thanks for pointing in the right direction. I updated the PR. |
Cheers mate and no worries! Easy to make mistakes Having looked around a bit, I see the usual format for User-Agent is I like adding the Auth@Edge version in there, so that we e.g. get If you're up to adding that, go for it. If that's a bit too much I can understand too let me know. Question: did you test it like this? Does this indeed work to not run into the WAF rule? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run prettier? (code formatting: npx prettier -w .
)
@@ -36,8 +36,9 @@ export const handler: CloudFrontRequestHandler = async (event) => { | |||
cookies.refreshToken | |||
); | |||
|
|||
const headers: { "Content-Type": string; Authorization?: string } = { | |||
const headers: { "Content-Type": string; Authorization?: string; "User-Agent":string } = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just change this type to OutgoingHttpHeaders
-- bit annoying to spell all keys we use out like this.
#264
if user agent is missing, it provides default agent with default max cached session 50.