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

Proxing changes cache-control from public to private #16

Closed
thomaspeklak opened this issue Sep 1, 2015 · 7 comments
Closed

Proxing changes cache-control from public to private #16

thomaspeklak opened this issue Sep 1, 2015 · 7 comments
Assignees
Labels
support Questions, discussions, and general support

Comments

@thomaspeklak
Copy link

I am trying to proxy an endpoint with hapi that provides a cache control header (max-age=30, must-revalidate, public). When I specify a simple onResponse handler with reply(res) (see below) all headers are passed correctly. Removing this handler and letting hapi do the work, results in a cache-control header of no-cache.

This was expected. I need to specify ttl: "upstream" in the route config, to pass along the cache headers. But then the cache-control header changes from public to private: 'max-age=30, must-revalidate, private'``

Dumb onResponseHandler:

function (err, res, req, reply, settings, ttl) {
    reply(res);
};
@osukaa
Copy link
Contributor

osukaa commented Sep 1, 2015

Are you specifying the passThrough options? Since it defaults to false it won't pass the headers.

passThrough - if set to true, it forwards the headers from the client to the upstream service, headers sent from the upstream service will also be forwarded to the client. Defaults to false.

@thomaspeklak
Copy link
Author

Ok, this would solve the problem with the cache headers. But I do not really want to have the proxy pass all headers from the client to the upstream.

I do specify my custom headers in a mapUri, does this overwrite the passthrough option in the upstream direction?

@osukaa
Copy link
Contributor

osukaa commented Sep 1, 2015

Yes, if you send the custom headers it will overwrite the ones of the original request even if the passThrough flag is set to true

@thomaspeklak
Copy link
Author

Shall i enhance the documentation to make this clearer? If yes, is this more a hapi or an h2o2 issue?

@osukaa
Copy link
Contributor

osukaa commented Sep 1, 2015

I think the documentation should be here. Send a PR :)

@osukaa osukaa self-assigned this Dec 13, 2015
@osukaa
Copy link
Contributor

osukaa commented Jan 12, 2016

@thomaspeklak I'll close this issue and you can create a new one with a PR

@osukaa osukaa closed this as completed Jan 12, 2016
@Marsup Marsup added support Questions, discussions, and general support and removed question labels Sep 21, 2019
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

4 participants