cryptofuture / urlhda

Open-source URL shortener - Solution for URL shortening: nginx, postgres, json
https://urlhda.hda.me/
GNU General Public License v3.0
17 stars 4 forks source link

Give live to urls without http/https #2

Closed UdoKifferbrehl closed 7 years ago

UdoKifferbrehl commented 8 years ago

Hello, when I type in "wallabag.org/blog/2016/01/08/wallabag-alpha1-v2" the short link is "https://hda.me/99f19" and does not work. Can you fix that please? Thank you very much!

cryptofuture commented 8 years ago

Thats quite interesting. Url works with http:// before url itself, but I think I can fix it with some nginx location rewrite.

cryptofuture commented 8 years ago

Actually this more complicated then I thought. Should be more nice solution with adding http to zero urls, then url checking implementation. Currently urls without http or https working as internal redirect.

location ~ "^/([0-9a-zA-Z]{5})$" {
    content_by_lua '
    local res = ngx.location.capture("/lookup",
    { args = { query = string.sub(ngx.var.request_uri, 2) } }
    );
    ngx.redirect(res.body);
    ';
    }

https://github.com/openresty/lua-nginx-module#ngxredirect

cryptofuture commented 8 years ago

This will be wontfix. Not sure its really even needed. When you copying long url to shorten, its always with http or https. Adding http by default is really bad, since most websites support https, but some not, and this will break url too. Until something like https proxy for http websites will be implemented in all popular browsers, this will be wontfix. I'm personally against any unencrypted connections. Crawl urls (for https support) will be bad too, since this will lead to privacy end.