{"action":"created","issue":{"url":"https://api.github.com/repos/mattgodbolt/gcc-explorer/issues/113","repository_url":"https://api.github.com/repos/mattgodbolt/gcc-explorer","labels_url":"https://api.github.com/repos/mattgodbolt/gcc-explorer/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/mattgodbolt/gcc-explorer/issues/113/comments","events_url":"https://api.github.com/repos/mattgodbolt/gcc-explorer/issues/113/events","html_url":"https://github.com/mattgodbolt/gcc-explorer/issues/113","id":143189140,"number":113,"title":"Serve shortened URLs from godbolt.org","user":{"login":"malcolmr","id":7025783,"avatar_url":"https://avatars.githubusercontent.com/u/7025783?v=3","gravatar_id":"","url":"https://api.github.com/users/malcolmr","html_url":"https://github.com/malcolmr","followers_url":"https://api.github.com/users/malcolmr/followers","following_url":"https://api.github.com/users/malcolmr/following{/other_user}","gists_url":"https://api.github.com/users/malcolmr/gists{/gist_id}","starred_url":"https://api.github.com/users/malcolmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malcolmr/subscriptions","organizations_url":"https://api.github.com/users/malcolmr/orgs","repos_url":"https://api.github.com/users/malcolmr/repos","events_url":"https://api.github.com/users/malcolmr/events{/privacy}","received_events_url":"https://api.github.com/users/malcolmr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"mattgodbolt","id":633973,"avatar_url":"https://avatars.githubusercontent.com/u/633973?v=3","gravatar_id":"","url":"https://api.github.com/users/mattgodbolt","html_url":"https://github.com/mattgodbolt","followers_url":"https://api.github.com/users/mattgodbolt/followers","following_url":"https://api.github.com/users/mattgodbolt/following{/other_user}","gists_url":"https://api.github.com/users/mattgodbolt/gists{/gist_id}","starred_url":"https://api.github.com/users/mattgodbolt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattgodbolt/subscriptions","organizations_url":"https://api.github.com/users/mattgodbolt/orgs","repos_url":"https://api.github.com/users/mattgodbolt/repos","events_url":"https://api.github.com/users/mattgodbolt/events{/privacy}","received_events_url":"https://api.github.com/users/mattgodbolt/received_events","type":"User","site_admin":false},"milestone":null,"comments":19,"created_at":"2016-03-24T08:52:51Z","updated_at":"2016-03-25T03:49:54Z","closed_at":null,"body":"Stack Overflow has banned goo.gl links, making it [hard to post links to GCC explorer](http://meta.stackoverflow.com/questions/319549/how-are-we-supposed-to-post-godbolt-links-now-that-url-shortening-is-blocked).\r\n\r\nOne solution to this would be to implement a URL shortener on godbolt.org directly, so that permalinks would be of the form gcc.godbolt.org/s/1234 (etc). However, that requires state.\r\n\r\nHere's an alternate proposal:\r\n\r\n1. Use Google's URL shortener as before, but rewrite the resulting URL from http://goo.gl/F02h38 to http://gcc.godbolt.org/s/F02h38 (say).\r\n2. Implement a handler for `/s/*` that [expands the URL server-side](https://developers.google.com/url-shortener/v1/getting_started#expand) (GET https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo.gl/F02h38&key=..., more documentation [here](https://developers.google.com/url-shortener/v1/url/get#request)) and verifies that the `longUrl` points to godbolt.org.\r\n3. Serve a 301 to the goo.gl URL (or a 404 if the shortened URL is invalid for any reason).\r\n\r\n(In step 3, you could also serve a 301 to the location you already have, but bouncing through goo.gl shouldn't be too bad for latency, and allows you to retain analytics; see e.g. http://goo.gl/F02h38+. I'd also find it a bit sketchy to just use goo.gl for storage.)\r\n\r\nThis should be acceptable to Stack Overflow, since the shortened URLs can only be used on the domain they already live on.\r\n\r\nSee also #112, though I think that's asking for something else."},"comment":{"url":"https://api.github.com/repos/mattgodbolt/gcc-explorer/issues/comments/201124737","html_url":"https://github.com/mattgodbolt/gcc-explorer/issues/113#issuecomment-201124737","issue_url":"https://api.github.com/repos/mattgodbolt/gcc-explorer/issues/113","id":201124737,"user":{"login":"mattgodbolt","id":633973,"avatar_url":"https://avatars.githubusercontent.com/u/633973?v=3","gravatar_id":"","url":"https://api.github.com/users/mattgodbolt","html_url":"https://github.com/mattgodbolt","followers_url":"https://api.github.com/users/mattgodbolt/followers","following_url":"https://api.github.com/users/mattgodbolt/following{/other_user}","gists_url":"https://api.github.com/users/mattgodbolt/gists{/gist_id}","starred_url":"https://api.github.com/users/mattgodbolt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattgodbolt/subscriptions","organizations_url":"https://api.github.com/users/mattgodbolt/orgs","repos_url":"https://api.github.com/users/mattgodbolt/repos","events_url":"https://api.github.com/users/mattgodbolt/events{/privacy}","received_events_url":"https://api.github.com/users/mattgodbolt/received_events","type":"User","site_admin":false},"created_at":"2016-03-25T03:49:54Z","updated_at":"2016-03-25T03:49:54Z","body":"Thanks for clarifying! I'll see what I can do."}}