Skip to content
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

Avoid overriding headers set in onresponse #129

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

fpavageau
Copy link

Currently, overriding a header from the target response in the source
response requires doing it in both ondata_response (when receiving the first
chunk of data) and in onend_response (for when the response doesn't contain
any data), after verifying that res.headersSent is false. That's clumsy at
best.

By filtering the copied headers with those already present in the source
response, it's possible to set them in onresponse once and for all.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@fpavageau fpavageau force-pushed the feature-keep-headers branch from 6e09a07 to cda1999 Compare July 24, 2019 13:53
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

gaonkar18y and others added 6 commits June 18, 2020 03:36
Add exception handling to logger when creating a log file.
Print logs to console if exeception in creating log file.
Add target hostname in 'transactionContextData' and use that to correctly print target hostname in event logs.
Apply only default plugins if 'request url' is present in global excludeUrls.
Skip the plugins whose excludeUrls includes the 'request url'.
Disable caching if 'disableExcUrlsCache' is set to 'true'.

A sample config is:

  plugins:
    excludeUrls: '/hello,/hello/'
    disableExcUrlsCache: true
    sequence:
      - oauth ## used for apikey verification #
      - json2xml
 json2xml:
   excludeUrls: '/hello/help'
Fix dependencies to use correct version of config
@keyurkarnik
Copy link
Collaborator

Please push this to for-3.1.6 branch

gaonkar18y and others added 9 commits August 16, 2020 23:39
Pass emg level configs to plugin's subconfig under key 'emgConfigs'.
Correct the path matcher to block invalid base paths.
Upgrade mocha to 7.0.0
Upgrade lodash to 4.17.19
Remove unused dependency 'helper'
… to close connection when using server sent events
Register the source response close event when target request is sent instead of registering after response is started to stream from target.
Currently, overriding a header from the target response in the source
response requires doing it in both ondata_response (when receiving the first
chunk of data) and in onend_response (for when the response doesn't contain
any data), after verifying that res.headersSent is false. That's clumsy at
best.

By filtering the copied headers with those already present in the source
response, it's possible to set them in onresponse once and for all.
@fpavageau fpavageau force-pushed the feature-keep-headers branch from 0e15a62 to fe57fae Compare August 19, 2020 09:47
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@fpavageau
Copy link
Author

I have rebased the branch on for-3.1.6, but I don't see how I can change the target branch of the PR to reflect that, which explains the warning by @googlebot, I guess. Should I open a new PR to replace this one?

@keyurkarnik
Copy link
Collaborator

The 3.1.6 branch is already scheduled for release. No worries, we will get this sorted out before the next release.
We will not have enough time to test the changes out anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants