apostrophecms / apostrophe-redirects

Allows admins to create redirects within an Apostrophe site
2 stars 2 forks source link

Redirects don't currently work for files #10

Closed bgantick closed 6 years ago

bgantick commented 6 years ago

Cause: Files served directly by nginx before redirects happen

Possible Solution: This probably won't be solved in this module. I think we need to do one/both of these things:

boutell commented 6 years ago

See disabledFileKey here:

https://github.com/punkave/uploadfs

This renames stuff that's in the trash, which would free up redirects.

If we make this part of what apostrophe-cli sets up for a new site, we'll have this licked for new sites.

For existing sites we'd need to create a migration tool that does not yet exist.

But once we do that we get clean content syncs with no "permission denied" for files in the trash as a fringe benefit.

On Thu, May 10, 2018 at 10:24 AM, Brian Gantick notifications@github.com wrote:

Assigned #10 https://github.com/apostrophecms/apostrophe-redirects/issues/10 to @boutell https://github.com/boutell.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe-redirects/issues/10#event-1619892977, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB9fdpeIEeAWvAWEE1rL_pBC2ag7Yyoks5txE22gaJpZM4T5-gN .

--

THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT P'UNK AVENUE | (215) 755-1330 | punkave.com

boutell commented 6 years ago

There is now a practical path to fix this:

  1. npm update

'apostrophe-attachments': {
  uploadfs: {
    disabledFileKey: 'very-random-string-please-not-this'
  }
}
  1. Deploy as usual. (Please note: I put these steps in this order for reasons)

  2. On the server, run this task to complete the transition:

node app apostrophe-attachments:migrate-to-disabled-file-key

Now files in the trash have their names changed rather than their permissions changed. Recommend verifying an example.

BENEFITS

  1. You can now sync down without permissions nonsense! Woo

  2. You can now create a redirect for the old URL of the file, because the file ain't there no more.

boutell commented 6 years ago

Brand-new punkave projects (created today from our client-boilerplate) should be good to go out of the box. You need to npm install -g apostrophe-cli though.

abea commented 6 years ago

Should disabledFileKey be documented in the apostrophe-attachments docs page? I could do that if so.

boutell commented 6 years ago

I think a HOWTO would make the most sense. We also have this happening by default in client-boilerplate for new projects.

On Tue, May 29, 2018 at 4:12 PM, Alex Bea notifications@github.com wrote:

Should disabledFileKey be documented in the apostrophe-attachments docs page? I could do that if so.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe-redirects/issues/10#issuecomment-392927735, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB9fYCxZKuv_heozGVKfRz0LLwWQraXks5t3ausgaJpZM4T5-gN .

--

THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT P'UNK AVENUE | (215) 755-1330 | punkave.com