Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Richard Atkinson 10 posts 100 karma points
    Feb 07, 2019 @ 15:25
    Richard Atkinson
    0

    IP Address sometimes in URL instead of domain name

    Hi,

    I have an application using Umbraco 7.4.3

    A new version of the code was compiled and release to production and I started to encounter strange behaviour with the front-end URLs.

    Users have reported that sometimes the URL contains the IP address instead of the domain name. Re-publishing a page fixes the issue temporarily , from a user point of view. However, the logs show URL calls with the IP address are still being made and eventually a user encounters the behaviour again. Even more strangely, other users do not experience the behaviour at the same time.

    The logs show this all started when the new code was deployed.

    I did not build the initial version of the application and cannot be sure the new version is an exact copy, plus my changes . Before I go comparing all the old code to the new code, does anybody know what may be causing the behaviour?

    Thanks

    Richard

  • louisjrdev 107 posts 344 karma points c-trib
    Feb 07, 2019 @ 17:05
    louisjrdev
    0

    Have you checked the culture and hostnames in the backoffice?

  • Richard Atkinson 10 posts 100 karma points
    Feb 08, 2019 @ 09:28
    Richard Atkinson
    0

    Thanks for the reply Louis.

    In "Culture and Hostnames" the Language is set to Inherit and no domains have been added.

  • louisjrdev 107 posts 344 karma points c-trib
    Feb 08, 2019 @ 09:35
    louisjrdev
    0

    I would probably go with what Kevin has said below however, if that does not fix the issue, then try adding your domain to the culture and hostnames and selecting the relevant language, as this might iron out any odd issues.

  • Richard Atkinson 10 posts 100 karma points
    Feb 08, 2019 @ 16:05
    Richard Atkinson
    0

    Thanks Louis.

    I'll look into this.

    Please let me know if you have any other thoughts anytime.

  • Kevin Jump 2343 posts 14890 karma points MVP 8x c-trib
    Feb 08, 2019 @ 09:32
    Kevin Jump
    0

    Hi

    Umbraco has an internal ApplicationURL it uses for a number of things, it gets this by taking the hostname from the very first request to the site.

    it's possible that the first request after deployment is to the IP address version of the site?

    you can force the value of this in the UmbracoSettings.Config file.

    https://our.umbraco.com/documentation/Reference/Config/umbracoSettings/#webrouting

  • Richard Atkinson 10 posts 100 karma points
    Feb 08, 2019 @ 10:34
    Richard Atkinson
    0

    Thanks Kevin,

    The old and new code have always had umbracoApplicationUrl set to the correct domain name.

    I cannot find the IP address anywhere in the code, database, and IIS settings. It would appear it is being determined from the machine the site is sitting on. Is there anywhere else Umbraco gets the hostname? Are there any settings, methods or objects I can search the code for?

    I don't know if this makes any difference but, for extra information, this Umbraco solution is two websites. One sits inside our firewall and the other outside it. All changes are done on the internal website and are "published" to the external site. The external site is a carbon copy of the internal except for a few configuration settings relevant to the environment. The internal site has never experienced the issue.

  • Kevin Jump 2343 posts 14890 karma points MVP 8x c-trib
    Feb 08, 2019 @ 11:47
    Kevin Jump
    0

    Hi Richard,

    I'm not sure but I had a poke around the Umbraco Code (mainly looking at IUrlProviders) - all it really points to is the URL coming from two locations :

    1. Assigned Domains (which I know you've looked at)
    2. Custom IUrlProvider ? - does the site have something in the pipeline that might change the URLs?

    Kevin

  • Richard Atkinson 10 posts 100 karma points
    Feb 08, 2019 @ 16:03
    Richard Atkinson
    0

    Kevin,

    Thanks for looking. There doesn't appear to be any custom UrlProvider use or any other custom routing.

    I'll have a look at the Assigned Domains and see what I can try there.

    I've been scouring the logs to narrow down what leads to the issue but no success yet. I'll try to capture more next time the issue occurs.

    If you have any other thoughts anytime then please let me know.

    Richard

  • Richard Atkinson 10 posts 100 karma points
    Feb 19, 2019 @ 09:32
    Richard Atkinson
    0

    Kevin and Louis,

    I have not been able to resolve the issue.

    I haven't tried the hostnames option yet as I was reluctant to immediately start changing the configuration in the production environment. However, I am ready to investigate this option.

    Before I do, please can you clarify the purpose and affects of adding hostnames. From my research, I understand that the feature is used when there are multiple websites on the same Umbraco instance. Should it also be used if there are multiple domains names that point to a single website? I have a redirect from another website and I am thinking that website's domain name should be added to hostnames.

    e.g.

    domainname1.com - all pages behave normally.

    domainname2.com (redirecting to domainname1.com) - domainname2.com is retained in the URL after the redirect.

    Maybe adding domainname2.com to hostnames will resolve the issue???

    Thanks

    Richard

  • louisjrdev 107 posts 344 karma points c-trib
    Feb 20, 2019 @ 13:17
    louisjrdev
    0

    Hi Richard,

    How are you performing the redirect from domain2 to domain1?

  • Richard Atkinson 10 posts 100 karma points
    Feb 20, 2019 @ 15:23
    Richard Atkinson
    0

    There is an IIS "HTTP Redirect" on domain2 which targets a certain page on domain1.

    "Redirect all requests to exact destination" is checked. "Only redirect requests to content in this directory" isn't checked.

    "Status Code" is set to "Permanent (301)"

  • louisjrdev 107 posts 344 karma points c-trib
    Feb 20, 2019 @ 15:30
    louisjrdev
    0

    So do you have an IIS binding on the site for domain2, if not i would try adding one

  • louisjrdev 107 posts 344 karma points c-trib
    Feb 19, 2019 @ 09:42
    louisjrdev
    0

    Hi Richard,

    Adding the hostname is relatively safe, you will want to add the domain that is ultimately resolved so domainname1.com would be then hostname you would want to add, it essentially tells umbraco that the site you have is associated with that domain only (with regards to urls umbraco know about), so it will try to force urls to use that domain. So it might fix the issue you are having.

    Im sure someone else may have a more educated or technical explanation but this is just my 2 cents from my experience with hostnames

  • Richard Atkinson 10 posts 100 karma points
    Feb 19, 2019 @ 10:24
    Richard Atkinson
    0

    Thanks Louis.

    I'll try to give this suggestion a go.

  • Tarik 196 posts 840 karma points c-trib
    Feb 19, 2019 @ 15:09
    Tarik
    0

    Richard Atkinson, have you set an A record for your 2nd domain ?

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Feb 19, 2019 @ 17:28
    Nicholas Westby
    0

    Not sure anybody has mentioned IIS bindings yet, but you can configure IIS to only respond to the domain name (i.e., if somebody did manage to request the site via IP address, it wouldn't work).

Please Sign in or register to post replies

Write your reply to:

Draft