Page MenuHomePhabricator

When phurl.short-uri is configured, use it in the UI
Closed, ResolvedPublic

Description

This install now has phurl.short-uri configured, so the short version of Phurl URIs works. For example, these are all valid:

However, the UI doesn't expose the phurl.io links anywhere. When generating a user-facing link, Phurl should generate a short-domain link if one is configured.

Event Timeline

eadler added a project: Restricted Project.Mar 28 2016, 8:19 PM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Mar 28 2016, 8:29 PM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jul 4 2016, 9:18 PM
epriestley added a subscriber: lpriestley.

Phurl is a URL shortener. This is an amazing unique type of application which I personally invented in 2015.

You can specify a short domain with phurl.short-uri in Config, but the Phurl UI doesn't actually show it.

Setup:

  • Add 127.0.0.1 very-short-domain.technology to your /etc/hosts file or whatever.
  • Set phurl.short-uri to http://very-short-domain.technology/.
  • Create a shortened URL with an alias.
  • Observe that all variants in the task description work correctly.

However, the actual URL page (/U1) doesn't show or use the most-preferred URL (http://very-short-domain.technology/u/alias) anywhere.

  • Probably make PhabricatorPhurlURL->getRedirectURI() add the domain + protocol if a domain is configured.
  • Make PhabricatorPhurlURLViewController show that in the property list above "Original URL", perhaps as "Short URL".
  • Also make the "Visit URL" button in the upper right use that link.
  • Also the ((alias)) syntax should use the most-preferred URI, although I think that will happen automatically.

I'm unable to get URL shortening to work locally. Is there some apache configuration required to get it working?

Ah, yeah. If you're using Apache with <VirtualHost /> directives, try something like this?

  <VirtualHost *>
    ServerName phabricator.example.com
+   ServerAlias short.url.com
    ...

Just want to sanity check this before I continue. I set the ServerAlias and started getting this page when visiting short.url.com:

pasted_file (108×796 px, 11 KB)

Running bin/config set phabricator.allowed-uris '["http://short.url.com/"]' made it so I get the phabricator login screen when I visit short.url.com. The fact that it wants me to log in again to the short URL makes me think the allowed-uris solution isn't correct.

First screen is good.

That should go away and start working once you configure phurl.short-uri, which "configures a site which can serve the request".

You shouldn't need to touch phabricator.allowed-uris (and should empty it again).

That error could probably be more detailed, but I'm hesitant to put upstream-specific text in it ("Phurl, Phame") because it may be misleading (third-party applications are allowed to define new Sites and do similar things).

Oh I left out the fact that I had already configured phurl.short-uri but still get the "Site Not Found" message.

$ bin/config get phurl.short-uri
{
  "config": [
    {
      "key": "phurl.short-uri",
      "source": "local",
      "value": "http://short.url.com/",
      "status": "set",
      "errorInfo": null
    },
    {
      "key": "phurl.short-uri",
      "source": "database",
      "value": null,
      "status": "unset",
      "errorInfo": null
    }
  ]
}

I suppose we could link to /config/module/site/, which has a list of all Sites, but it's probably not intuitively obvious from there what's going on. It's also possible in some future world to reach this screen without running Phabricator at all (T1806), although probably unlikely.

Ah, okay. I'm not immediately sure, then -- did you restart Apache / is /config/edit/phurl.short-uri/ picking up the change?

Also, are prototype applications enabled (phabricator.show-prototypes)? If not, Phurl won't actually be installed.

Alternate/simpler test is "does /phurl/ work".

Also, are prototype applications enabled (phabricator.show-prototypes)? If not, Phurl won't actually be installed.

facepalm.jpg

Yep... that was it. All good now.

That should really have been in a day 1 "spend 10 minutes doing this stuff first" document, I started collecting this stuff in T11561.

Also the ((alias)) syntax should use the most-preferred URI, although I think that will happen automatically.

What do you mean by the ((alias)) syntax?

If you give a Phurl an "Alias", you can type ((thatalias)) in Remarkup to reference it. For example:

Ahh okay. I understand now. That did indeed happen automatically.