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

Only add redirects if not already in place #132

Closed
ekristen opened this issue Nov 19, 2014 · 12 comments
Closed

Only add redirects if not already in place #132

ekristen opened this issue Nov 19, 2014 · 12 comments

Comments

@ekristen
Copy link

s3_website does a great job of only pushing new pages, assets, etc that have changed or don't exist. Even does a good job deleting old files, but everytime it runs it re-applies every redirect from the config. It would be nice for it to only apply it if it doesn't already exist.

@ekristen
Copy link
Author

One more comment, I'd love to help facilitate this, but I'm not a java person.

Also this isn't really a problem when you have 5-10 redirects, but I'm migrating a website and my redirect list is upwards of 1500.

@laurilehmijoki
Copy link
Owner

s3_website always applies the redirects for performance reasons. If s3_website would like to know whether a redirect already exist on S3, it would have to perform one extra HTTP request for each configured redirect.

In your case, this would mean 1500 extra HTTP request.

I agree with you that the console output on redirect applications is annoying, especially if you have plenty of redirects.

We could print the redirect application messages only when the user pushes the --verbose switch. What do you think about this possibility?

@ekristen
Copy link
Author

Interesting.

How does s3_website know not to push files that haven't changed?

Erik

On Nov 19, 2014, at 6:09 AM, Lauri Lehmijoki notifications@github.com wrote:

s3_website always applies the redirects for performance reasons. If s3_website would like to know whether a redirect already exist on S3, it would have to perform one extra HTTP request for each configured redirect.

In your case, this would mean 1500 extra HTTP request.

I agree with you that the console output on redirect applications is annoying, especially if you have plenty of redirects.

We could print the redirect application messages only when the user pushes the --verbose switch. What do you think about this possibility?


Reply to this email directly or view it on GitHub.

@ekristen
Copy link
Author

@laurilehmijoki I'm assuming s3_website knows not to push a file because of the listing it gets from s3.

Wouldn't it make more sense to compare a list of redirects to that same listing where size is 0, and only modify if they don't match?

@laurilehmijoki
Copy link
Owner

You are right, s3_website uses GetBucket for determining the deltas.

Your idea is interesting. We could start treating zero-length objects as redirect objects. Do any nasty corner cases come into your mind?

@ekristen
Copy link
Author

As long as s3 website is the only thing deploying to the bucket it should be a problem. There could be a config option to turn it off or on, I would really appreciate this feature, if I can help anyway, please let me know.

@laurilehmijoki
Copy link
Owner

Okay, so let's add an option for expressing the intent "skip redirect application if the length of the object is zero".

Would you find the option treat_zero_length_objects_as_redirects: true to be a good name for this expression? Can we invent a better name? The users would define that option in the s3_website.yml file.

Once that setting is on, the user needs to use push --force if he wants to modify an existing redirect. I find this an acceptable compromise. What do you think about this?

@ekristen
Copy link
Author

I find that acceptable. However it might be nice to also have a —force-redirects only option? Just a thought? If not I’m fine with the —force option, either way this will be an awesome feature.

Thank you.

On Nov 21, 2014, at 6:29 AM, Lauri Lehmijoki notifications@github.com wrote:

Okay, so let's add an option for expressing the intent "skip redirect application if the object is length is zero".

Would you find the option treat_zero_length_objects_as_redirects: true to be a good name for this expression?

Once that setting is on, the user needs to use push --force if he wants to modify an existing redirect. I find this an acceptable compromise. What do you think about this?


Reply to this email directly or view it on GitHub.

@laurilehmijoki
Copy link
Owner

I just released the version 2.7.0 where you can use the treat_zero_length_objects_as_redirects: true setting. Please get back here if you spot any anomalities.

@laurilehmijoki
Copy link
Owner

I created a new issue on the --force-redirects idea: #133.

@ekristen
Copy link
Author

I will test today/tomorrow and let you know. Thanks for this!

@ekristen
Copy link
Author

Tested and works great. Thanks!

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

2 participants