fredjean/middleman-s3_redirect

New redirects not overwritten

Closed this issue · 9 comments

It may just be me doing something wrong, but ...

I wrote a redirect from Page A -> Page B, just to see how it worked (it does work). But when I want to revise the redirect from Page A -> Page C, I still get redirected to Page B.

Shouldn't writing a new rule overwrite the previous?

Also -- does this gem support regex?

Thank you in advance!

I'm looking into this one...

Could you send me a sanitized version of your configuration? I was able to overwrite redirect rules on my site while trying to reproduce your issue.

Thanks for looking into this! I probably did something stupid...

in config.rb

# Redirects
activate :s3_redirect do |config|
  config.bucket                      = 'www.site.com' # The name of the S3 bucket you are targetting. This is globally unique.
  config.region                      = 'us-east-1'     # The AWS region for your bucket.
  config.aws_access_key_id           = 'AWS KEY ID'
  config.aws_secret_access_key       = 'AWS SECRET KEY'
  config.after_build                 = false # We chain after the build step by default. This may not be your desired behavior...
end

redirect '/fold/a', '/fold/b'

Am I supposed to have the redirect rules in the config file?

That is where I put the redirect instructions as well. You should be able to change the '/fold/b' path to '/fold/c' and see the object get updated in the S3 bucket.

Hmm.. that doesn't happen for me. I'll see how I'm configured on my end though. Perhaps some kind of cacheing?

Another question -- what kind of redirects are these? 301? 302? Would you know?

Thank you again!!!

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The redirects are all 301, permanent redirects. It is possible that
there is some caching involved. I can have a look if you give me the URL
that should be redirecting.

Fred

On 06/13/2014 11:06 AM, sarahbkim wrote:

Hmm.. that doesn't happen for me. I'll see how I'm configured on my
end though. Perhaps some kind of cacheing?

Another question -- what kind of redirects are these? 301? 302? Would
you know?

Thank you again!!!


Reply to this email directly or view it on GitHub
#6 (comment).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTm0hMAAoJED6mjh6UPxA4vZYQAISjCT91q7LaVH7L1L9fEJlz
28j8zC35EosMup+g4Q154mA1/0WMCgBAoMXM/9AiyEutwzs3vuQ9IOD3FT4XKCNh
/IE2PValBb2UrDIEUBbFN4yuBOyHqlZsNAc/K/cTXL5Bw8yIuoT+dFfrdRgoaERv
Ut7B9raPSbdH9qKCsjDJDwj3rEL3lQrTFBaiMz7X8mjqIH8kV/KULxKlPDqM8MyA
rwEAcz4kWhPrcXCjb2Arei/m4iu/AR0d/gvFRbP4WUPf0L0qA79LzFM+u8Jywm8q
yTmhIRvwYXNcoR7lylU2/Lb00hW/PBKYPfszdXfkp6TlSgCYGEuMVyLEifRuCnRY
kzWnfjMjbBVsnp1Mrpk4FTgZ1Y5ecjZuQp9PuWaNNJs+q4PVUT4wKd8nJKmDZjiE
FfgxElQGQWGPg/lno4togkXQTxg2cV2XS+msgDXFE/C4amlcWMFWUgm1pPBo24Lw
NZzw/B9Sokqo1LUupyU2SSHY/MxxkeJEDVZ6S49+0hBX5u42vF1RocWrtJ6izB7C
MOOpjIt6JXsIWcZ4ptcRNrqG80Qt9optozW6t/wLaDVmranq9Lq4LY3H4OjROfOK
S/un1mp4eeTaMwdb4MhUD9MWfAadqKwN+YxwtMZjQhsJXhqxR4yk+JBuf9lEGj9Q
YJxYtudPmGVnN6eQp9Ps
=Wexp
-----END PGP SIGNATURE-----

Here is what I found using curl:

The http://preview.onemedical.com/sf/how-we-work URL does redirect to http://preview.onemedical.com/sf/how-were-different:

$ curl -I http://preview.onemedical.com/sf/how-we-work/
HTTP/1.1 301 Moved Permanently
x-amz-id-2: SwTALKmQ3k8I1u//weWOatMx2gRgE3z6+09Pbm6vJ7RgZ49qiHRAQhiD9WqBzSUP
x-amz-request-id: D7ED3DC2083E70CB
Date: Sat, 14 Jun 2014 21:17:20 GMT
Location: /sf/how-were-different
Content-Length: 0
Server: AmazonS3

I ran curl to see what I would get when requesting http://preview.onemedical.com/sf/how-were-different . The response shows that there is another redirect to your http://preview.onemedical.com/sf/physicians page:

$ curl -I http://preview.onemedical.com/sf/how-were-different/
HTTP/1.1 301 Moved Permanently
x-amz-id-2: MLAjLFAnNogqi0S/aUd5tkv5fxhpu6xm+EXatav1tYD0lQWkNB8OLRLZlfLofkUk
x-amz-request-id: 535F09CB32196403
Date: Sat, 14 Jun 2014 21:18:20 GMT
Location: /sf/physicians
Content-Length: 0
Server: AmazonS3

My conclusion is that the first redirect is correct. You need to remove the second one. It should be possible to do so without too much trouble.

Let me know if there is something else that I can help you with.

thanks so much!!