Giter Site home page Giter Site logo

Comments (4)

sporkmonger avatar sporkmonger commented on July 21, 2024

Sure... uhm, if it were possible or in any way in-scope for the library. This is something that really needs to be solved at the DNS / web server level. Addressable can't really help here.

from addressable.

maxwell avatar maxwell commented on July 21, 2024

Hi, sorry, I guess I was not clear enough.

For example say I have some sort of SSL requirement which requires 'www' in my url. (ie I am using EC2 or Heroku).

However, in the case that people are Webfingering my domain, these requests are going to my 'apex' domain.

a = Addressable::URI.parse('https://www.myssldomain.com')
a.authority  #=> www.myssldomain.com
a.host #=> www.myssldomain.com

#what I am trying to propose would be kind of nice

a.apex_domain #=> myssldomain.com

As you mentioned, I realize this is not hard to do by gsubing out the 'www.', but it feels dirty and something Addressable or URI should accomplish, given that Addressable has other nice to haves in the library.

from addressable.

sporkmonger avatar sporkmonger commented on July 21, 2024

Ok, I see what you mean. That's fair. Low priority at the moment though.

from addressable.

sporkmonger avatar sporkmonger commented on July 21, 2024

Started thinking about trying to implement this today. After about 15 minutes I realized that this isn't actually possible to build correctly without rather extensive tables of TLDs and second level domains that I'm not inclined to introduce.

uri = Addressable::URI.parse('https://www.example.com/')
uri.zone_apex # => 'example.com'
uri = Addressable::URI.parse('https://www.example.co.ke/')
uri.zone_apex # => 'example.co.ke'

If it could be done with a simple regular expression, that'd be one thing, but as far as I can tell, the zone apex can exist at several different levels depending on where and how the domain was registered.

from addressable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.