Welcome! Log In Create A New Profile

Advanced

Re: Too Many Redirects - CDN Rewrite Rule

All files from this thread

File Name File Size   Posted by Date  
smime.p7s 6 KB open | download GreenGecko 03/20/2013 Read message
smime.p7s 3.5 KB open | download Kiril Kalchev 03/22/2013 Read message
Francis Daly
March 22, 2013 05:28AM
On Thu, Mar 21, 2013 at 06:48:43PM -0400, toddlahman wrote:

Hi there,

> The reply I received from NetDNA after supplying the same information as I
> did here is as follows:
>
> "Too many redirects" is a legit message in this scenario - example: You are
> redirecting domain.com/file.jpg TO cdn.domain.com/file.jpg ---> request
> comes to CDN and CDN neds to cache this file from origin so it tries to
> fetch from origin from location "domain.com/file.jpg" ---> request comes to
> origin and redirect rule you made redirects this request back to CDN <---
> this is where infinite loop starts.

Ah, okay, that makes sense. You don't upload to the CDN; it instead
mirrors your content on demand. (That was the part I had missed.)

As was mentioned, the correct solution is for all of your links to
actually be to things like http://cdn.domain.com/file.jpg; but as was
also mentioned, that is not a quick change for you.

The NetDNA suggestion -- to serve when it comes from them and to redirect
when it comes from others -- is reasonable; but as they also indicate,
"when it comes from them" is non-trivial to get right, and will be a
problem if you ever get it wrong in one direction.

Using proxy_pass in your nginx would defeat the main purpose of using
a CDN, as your own bandwidth would be used always.

An alternative possibility could be for you to set up another
server{} block with a server_name of (say) cdn-src.domain.com which
has the same document root as your main one, but which just serves
the static files. Then, at the point where your CDN is configured to
map cdn.domain.com/file.jpg -> domain.com/file.jpg, map it instead to
cdn-src.domain.com/file.jpg.

With no change to your application, your users go to domain.com/something
and follow a link to domain.com/file.jpg; your "main" server redirects
them to cdn.domain.com/file.jpg; they get that, which fetches (now
successfully) cdn-src.domain.com/file.jpg and returns it to the user.

Does that sound like it might do what you want, without taking too
much effort to keep synchronised?

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Too Many Redirects - CDN Rewrite Rule

toddlahman March 20, 2013 10:47PM

Re: Too Many Redirects - CDN Rewrite Rule Attachments

GreenGecko March 20, 2013 11:02PM

Re: Too Many Redirects - CDN Rewrite Rule

toddlahman March 21, 2013 12:20AM

Re: Too Many Redirects - CDN Rewrite Rule

Francis Daly March 21, 2013 02:12PM

Re: Too Many Redirects - CDN Rewrite Rule

toddlahman March 21, 2013 03:13PM

Re: Too Many Redirects - CDN Rewrite Rule

Jonathan Matthews March 21, 2013 03:18PM

Re: Too Many Redirects - CDN Rewrite Rule

toddlahman March 21, 2013 03:39PM

Re: Too Many Redirects - CDN Rewrite Rule

Jonathan Matthews March 21, 2013 03:54PM

Re: Too Many Redirects - CDN Rewrite Rule

toddlahman March 21, 2013 06:48PM

Re: Too Many Redirects - CDN Rewrite Rule

Peter Booth March 22, 2013 12:32AM

Re: Too Many Redirects - CDN Rewrite Rule Attachments

Kiril Kalchev March 22, 2013 05:34AM

Re: Too Many Redirects - CDN Rewrite Rule

Francis Daly March 22, 2013 05:28AM

Re: Too Many Redirects - CDN Rewrite Rule

Francis Daly March 21, 2013 03:22PM

Re: Too Many Redirects - CDN Rewrite Rule

Peter Booth March 21, 2013 02:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 248
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready