YOURLS / YOURLS

🔗 The de facto standard self hosted URL shortener in PHP
https://yourls.org
MIT License
10.81k stars 1.95k forks source link

Question: Changing Underlying File Location #2496

Closed TechRemarker closed 5 years ago

TechRemarker commented 5 years ago

Creating a Digital Ocean Space (equivalent of Amazon S3). For the past month their east coast data center for spaces has been unavailable for creating new Spaces. They suggest West Coast in the meantime.

While one can do that, and presumably later change to east coast datacenter would this change be possible without negatively affecting existing links.

For instance, I'll be setting up a custom domain such as myshare . com and using with DropShare. So the the links I send would be myshare . com / fdfkldjflk but the underlying file would actually be located at myshare . westcoast . digitalocean . com / fdfkldjflk for instance. Later on would be able to change to the east coast and update those underlining links some how and not break any of the old links, DropShare functionality or Yourls functionality? Or am I simply asking for trouble?

Would rather wait for DigitalOcean to fix their datacenter but it's been a month so don't want to wait indefinitely. Hopefully this is the right place to ask this type of question.

dgw commented 5 years ago

I'm confused what DropShare has to do with YOURLS… I'm not familiar with that product.

TechRemarker commented 5 years ago

Dropshare is a GUI app for Mac that adds an interface to sharing files. Similar to Cloud App, Droplr, among others. Dropshare allows you to use any service provider to host vs having to use their own.

So I would drop a file onto a menu icon it will automatically upload the file to the server/service of myself, generate a link to either the download file or view on a custom landing page, etc, and generates short link and can do link expiration, password protection and all that jazz. It supports bitly and those, but want to use my own link service so I don't have to worry about the service going out of business someday. So it also supports custom link shortners, in this case YOURLS.

dgw commented 5 years ago

Ah, OK. Wise choice to run your own shortener, and I wish I had learned that lesson sooner.

It's tricky to look at some of this stuff (code & docs) at the moment, on my phone. But if the "file" on Digital Ocean Spaces really is a file, and only the (for example) westcoast part of the URL will change, you'll be able to update that either through the YOURLS interface (individually) or in the database with a SQL query (all at once).

Updating links always comes with a bit of risk from clients that have already cached the redirect, so you might want to install a plugin for YOURLS that changes the redirect status code from 301 (moved permanently) to 302 (found) or 307 (temporary redirect). Those latter two are much less aggressively cached by clients and intermediate services like Cloudflare if you use one.

TechRemarker commented 5 years ago

Thank you! Very helpful. I'm going to hold off a little longer in hopes DO gets this Spaces region resolved, but if not luck will try setting the up and utilize those tips noted here.

I had use Goo.gl shortner for a while and even that went away, so no matter how big or small the company they can all go, so going self hosted is definitely ideal and glad to see this is open source and has been around for so long and seems to be thriving.