INN / impaq-me

A social fundraising tool that enables funders to give money to nonprofits any time a user shares one of their stories and/or someone clicks back to the site via an impaq.me short url. This project is no longer active.
http://impaq.inn.org
GNU General Public License v2.0
0 stars 0 forks source link

Implement cdn #94

Closed searls closed 10 years ago

searls commented 10 years ago

Just to get the ball rolling, I created a cloudfront distribution for impaq.me's new staging environment under test double (looks like this):

screen shot 2014-06-04 at 10 50 21 pm

Resolves #73

Deployed to our new staging URL ( http://impaqme-712.herokuapp.com/ ) and currently testing

searls commented 10 years ago

:+1: this appears to be working well.

searls commented 10 years ago

Frustratingly thanks to this issue in rails https://github.com/rails/rails/issues/10051 the redirect we just implemented in #93 won't point to the CDN unless we manually work around it or upgrade to 4.1

searls commented 10 years ago

That workaround in e0c2238 is not ideal b/c it required me to (short of making things even complex by sniffing the protocol of the originating request) make all cdn requests http-only. Would really like to upgrade to rails 4.1 but bundler was fighting with me and our git-based dependency on mongoid is proving problematic (sigh).

anyway if you look at staging and you try to grab the script from http://impaqme-712.herokuapp.com/scripts/sdk.js you'll get redirected to http://dwvr7sy8vvpog.cloudfront.net/assets/lineman/sdk/impaq-me-sdk.min-b2217e2463192c02d01e3ae77d0b7f29.js (or whatever is latest), which is an improvement b/c it means that our dynos won't need to serve up that asset which looks like it's hotlinked by most partners. That redirect still requires rails dispatch which is expensive. Would rather move the SDK to an open source repo that expects webmasters to pull it into their own builds

jasonkarns commented 10 years ago

Speaking pedantically, the 302 status code is deprecated. In practice, it functions as 303, which is not what we want here. (303 is what should be issued after create requests to redirect to the created resource. the distinction is that it requires a change of method from PUT/POST/DELETE to GET)

The redirect ought to be served via 307. As I mentioned on slack, this raises some caching issues.

searls commented 10 years ago

I don't know which code it gives. I just use 302 as shorthand for "redirect" because that's what action pack redirect_to emits

This won't be an issue for long as we move to a downloaded ask script

I don't want that URL to be cacheable regardless.

On Thu, Jun 5, 2014 at 8:38 AM, Jason Karns notifications@github.com wrote:

Speaking pedantically, the 302 status code is deprecated. In practice, it functions as 303, which is not what we want here. (303 is what should be issued after create requests to redirect to the created resource. the distinction is that it requires a change of method from PUT/POST/DELETE to GET)

The redirect ought to be served via 307. As I mentioned on slack, this raises some caching issues.

Reply to this email directly or view it on GitHub: https://github.com/testdouble/impaq-me/pull/94#issuecomment-45213780