Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not use the ToRootUrlString to ensure port numbers are correct #6

Open
I3undy opened this issue Dec 1, 2015 · 8 comments
Open

Comments

@I3undy
Copy link
Member

I3undy commented Dec 1, 2015

rdobson created on Sep 3, 2014:
https://combinator.codeplex.com/workitem/65

I have created my own extension method that calls the built in Orchard method but instead returns a Uri of the following in UriExtensions.cs:

public static Uri ToBaseUri(this HttpRequestBase request) {
        return new Uri(request.ToRootUrlString());
    }

Then used this instead of Request.Url in:

  • Models/CombinatorResource.cs AbsoluteUrl
  • Services/CacheFileService.cs GetCombinedResources
@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

@Piedone commented on Sep 3, 2014:

I'm not sure I'm following. How exactly would you change CombinatorResource..AbsoluteUrl and what is the aim?

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

rdobson commented on Sep 3, 2014:

AbsoluteUrl is changed to

public Uri AbsoluteUrl
{
    get
    {
        var fullPath = NormalizedFullPath;

        if (Uri.IsWellFormedUriString(fullPath, UriKind.Absolute)) return new Uri(fullPath);
        return new Uri(_httpContext.Request.ToBaseUri(), RelativeUrl);
    }
}

This is in order to make sure the correct port is maintained, this is important when trying to debug under the Azure Emulator as the port should be but when using _httpContent.Request.Url it thinks it is 82 because that is what it is behind the load balancer, without this fix it makes it impossible to debug.

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

@Piedone commented on Sep 5, 2014:

So you experience this when running the Azure Orchard solution, right?

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

rdobson commented on Sep 8, 2014 :

Yes that's correct

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

@Piedone commented on Sep 8, 2014:

I see. For every other scenario this should be equivalent to the current code but I'm not sure about the case when sites are sitting behind a reverse proxy. I'll do some tests.

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

@Piedone commented on Sep 8, 2014

With your modification from the other issue I mean?:

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

rdobson commented on Sep 8, 2014:

Not for resources that are hosted in the webrole, without seeing where the cache files are hosted it tries to use uri.PathAndQuery for those which is not correct if the cache file is hosted outside of the webrole the urls become broken, its got nothing to do with ports at that point, the resources hosted on the webrole need to have absolute url's if the cache file is outside of the webrole, not relative ones.

@I3undy
Copy link
Member Author

I3undy commented Dec 1, 2015

rdobson commented on Sep 8, 2014:

To put it another way if there is a url quite legitimately of /Module/Styles/image.png it will stay as that in the blob cache file which would then be trying to reference http://storageaccount.blob.core.windows.net/Module/Styles/image.png rather than the correct url of http://www.website.com/Module/Styles/image.png.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant