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

ReverseProxy on Heroku with RackCache? #24

Open
kbighorse opened this issue Sep 26, 2012 · 5 comments
Open

ReverseProxy on Heroku with RackCache? #24

kbighorse opened this issue Sep 26, 2012 · 5 comments

Comments

@kbighorse
Copy link

Here's my config in config/production.rb:

https://gist.github.com/3786109

Heroku logs output:

https://gist.github.com/3786102

Went off this blog post:

http://bindle.me/blog/index.php/304/rack-middleware-for-seo-fun-and-profit

I realize I didn't use the RegEx, but I got a similar result when I did.

thank you!

@jaswope
Copy link
Owner

jaswope commented Sep 26, 2012

Hrmm, I don't see anything in there that signifies that this is a problem with rack-reverse-proxy. It looks like Rack::Cache is choking on a cache-control header, but I'm not sure where to point you for that.

@kbighorse
Copy link
Author

OK, that might be true, but I also have a problem when I try in development, here's my output:

https://gist.github.com/3790532

Here's my config/development.rb:

https://gist.github.com/3790540

@peterwald
Copy link

Turns out that all of the header values sent through reverse_proxy are wrapped in an array rather than a plain string. This breaks Rack::Cache further up the line.

{
 "content-type"=>["text/html; charset=UTF-8"],
 "connection"=>["keep-alive"],
 "keep-alive"=>["timeout=20"],
 "x-ua-compatible"=>["IE=Edge,chrome=1"],
 "x-cacheable"=>["SHORT"],
 "vary"=>["Accept-Encoding,Cookie"],
 "cache-control"=>["max-age=600, must-revalidate"],
 "x-cache"=>["HIT: 1"],
 "x-cache-group"=>["normal"],
 "x-type"=>["default"]
}

Rack::Cache is expecting the Cache-Control header to be "cache-control" => "max-age=600, must-revalidate" instead.

@kbighorse
Copy link
Author

So maybe I should submit a patch to Rack::Cache? or submit a patch to send a string arg from ReverseProxy?

@peterwald
Copy link

I submitted a pull request with my patch that fixes the issue for me. #25

AFAIK, the Rack interface expects headers to be strings. Returning them as an array is not expected.

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

3 participants