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

Prefer Header with Proxy Mode #16

Closed
ikreymer opened this issue Feb 28, 2018 · 1 comment
Closed

Prefer Header with Proxy Mode #16

ikreymer opened this issue Feb 28, 2018 · 1 comment

Comments

@ikreymer
Copy link
Contributor

Ensure Prefer header also works with proxy mode.

Use of Prefer should result in no redirect and serve either the raw content or standard proxy-mode rewritten content and include Preference-Applied.

Probably should have a different Preference-Applied for proxy-mode rewriting, which only injects the banner, instead of full rewriting. Perhaps Preference-Applied: banner-injected

ikreymer added a commit to ukwa/pywb that referenced this issue Feb 28, 2018
- fix proxy mode when 'redirect_to_exact=True' is set config, don't redirect in proxy mode
- more general prefer support, moved to content_rewriter to support preference<->mod mappings
- add 'banner-only' preference mapped to bn_ modifier
- proxy mode: allow 'raw' and 'banner-only' preferences
- proxy mode: 'Prefer: rewritten' forced to 'banner-only', served with 'Preference-Applied: banner-only'
- tests: test proxy with prefer header, 'redirect_to_exact=True', add 'banner-only' to Prefer header tests in rewriting mode
@ikreymer
Copy link
Contributor Author

Added a new Prefer: banner-only, which corresponds to the bn_ modifier, and represents 'banner-only' where the banner insertion is added to the <head> but the content is otherwise unaltered.

Since proxy mode does not support rewriting, if Prefer: rewritten is received in proxy mode, the response is Preference-Applied: banner-only (also the default). Prefer: raw is supported in proxy mode.

In rewriting replay mode, all 3 raw, banner-only, and rewritten can be used.

Added unit and robot integration tests to verify this behavior.

N0taN3rd pushed a commit to webrecorder/pywb that referenced this issue Sep 3, 2019
- fix proxy mode when 'redirect_to_exact=True' is set config, don't redirect in proxy mode
- more general prefer support, moved to content_rewriter to support preference<->mod mappings
- add 'banner-only' preference mapped to bn_ modifier
- proxy mode: allow 'raw' and 'banner-only' preferences
- proxy mode: 'Prefer: rewritten' forced to 'banner-only', served with 'Preference-Applied: banner-only'
- tests: test proxy with prefer header, 'redirect_to_exact=True', add 'banner-only' to Prefer header tests in rewriting mode
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

No branches or pull requests

1 participant