Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    How to configure the proget free with self-connector

    Scheduled Pinned Locked Moved Support
    13 Posts 3 Posters 46 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • rhessingerR Offline
      rhessinger inedo-engineer
      last edited by

      Hi @viceice,

      ProGet free edition only supports self-connectors when they connect directly to ProGet. If you bypass the proxy, that should resolve the license violations for you.

      Thanks,
      Rich

      Products Engineer, Inedo

      1 Reply Last reply Reply Quote 0
      • V Offline
        viceice
        last edited by

        Can i simply use http://localhost instead of my real https://proget.xxxx.com ?

        I've configured https://proget.xxxx.com as Web.BaseUrl.

        rhessingerR 1 Reply Last reply Reply Quote 0
        • rhessingerR Offline
          rhessinger inedo-engineer @viceice
          last edited by

          Hi @viceice,

          You should be able to use http://localhost or http://<PROGET_IP_ADDRESS> in your connector without issue. Please give that a try and let me know if you run into any issues.

          Thanks,
          Rich

          Products Engineer, Inedo

          1 Reply Last reply Reply Quote 0
          • V Offline
            viceice
            last edited by

            Nope, the http://localhost/nuget/Release/v3/index.json points back to the public url, and proget will follow and use the https reverse proxy again.

            So i again get the error.

            atrippA 1 Reply Last reply Reply Quote 0
            • V Offline
              viceice
              last edited by

              now trying again with Web.BaseUrl set to empty.

              so the index.json looks like for http://localhost

              {
                  "version": "3.0.0",
                  "resources": [{
                          "@id": "http://localhost/nuget/Release/v3/search",
                          "@type": "SearchQueryService",
                          "comment": "Query endpoint of NuGet Search service"
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/search",
                          "@type": "SearchQueryService/3.0.0-rc",
                          "comment": "Query endpoint of NuGet Search service"
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/search",
                          "@type": "SearchQueryService/3.0.0-beta",
                          "comment": "Query endpoint of NuGet Search service"
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/autocomplete",
                          "@type": "SearchAutocompleteService",
                          "comment": "Autocomplete endpoint of NuGet Search service"
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/autocomplete",
                          "@type": "SearchAutocompleteService/3.0.0-rc",
                          "comment": "Autocomplete endpoint of NuGet Search service"
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/autocomplete",
                          "@type": "SearchAutocompleteService/3.0.0-beta",
                          "comment": "Autocomplete endpoint of NuGet Search service"
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/registrations/",
                          "@type": "RegistrationsBaseUrl",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/registrations/",
                          "@type": "RegistrationsBaseUrl/3.0.0-rc",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/registrations/",
                          "@type": "RegistrationsBaseUrl/3.0.0-beta",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/registrations-gz/",
                          "@type": "RegistrationsBaseUrl/3.4.0",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/registrations-gz/",
                          "@type": "RegistrationsBaseUrl/3.6.0",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/flatcontainer",
                          "@type": "PackageBaseAddress/3.0.0",
                          "comment": "Base URL of where NuGet packages are stored, in the format https://api.nuget.org/v3-flatcontainer/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg"
                      }, {
                          "@id": "http://localhost/feeds/Release/{id}/{version}",
                          "@type": "PackageDetailsUriTemplate/5.1.0",
                          "comment": "URI template used by NuGet Client to construct details URL for packages"
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/registrations/{id-lower}/index.json",
                          "@type": "PackageDisplayMetadataUriTemplate/3.0.0-rc",
                          "comment": "URI template used by NuGet Client to construct display metadata for Packages using ID"
                      }, {
                          "@id": "http://localhost/nuget/Release/v3/registrations/{id-lower}/{version-lower}.json",
                          "@type": "PackageVersionDisplayMetadataUriTemplate/3.0.0-rc",
                          "comment": "URI template used by NuGet Client to construct display metadata for Packages using ID, Version"
                      }, {
                          "@id": "http://localhost/nuget/Release/",
                          "@type": "LegacyGallery"
                      }, {
                          "@id": "http://localhost/nuget/Release/",
                          "@type": "LegacyGallery/2.0.0"
                      }, {
                          "@id": "http://localhost/nuget/Release/package",
                          "@type": "PackagePublish/2.0.0"
                      }
                  ]
              }
              
              

              and for https://proget.xxx.com

              {
                  "version": "3.0.0",
                  "resources": [{
                          "@id": "https://proget.xxx.com/nuget/Release/v3/search",
                          "@type": "SearchQueryService",
                          "comment": "Query endpoint of NuGet Search service"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/search",
                          "@type": "SearchQueryService/3.0.0-rc",
                          "comment": "Query endpoint of NuGet Search service"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/search",
                          "@type": "SearchQueryService/3.0.0-beta",
                          "comment": "Query endpoint of NuGet Search service"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/autocomplete",
                          "@type": "SearchAutocompleteService",
                          "comment": "Autocomplete endpoint of NuGet Search service"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/autocomplete",
                          "@type": "SearchAutocompleteService/3.0.0-rc",
                          "comment": "Autocomplete endpoint of NuGet Search service"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/autocomplete",
                          "@type": "SearchAutocompleteService/3.0.0-beta",
                          "comment": "Autocomplete endpoint of NuGet Search service"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/registrations/",
                          "@type": "RegistrationsBaseUrl",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/registrations/",
                          "@type": "RegistrationsBaseUrl/3.0.0-rc",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/registrations/",
                          "@type": "RegistrationsBaseUrl/3.0.0-beta",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/registrations-gz/",
                          "@type": "RegistrationsBaseUrl/3.4.0",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/registrations-gz/",
                          "@type": "RegistrationsBaseUrl/3.6.0",
                          "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/flatcontainer",
                          "@type": "PackageBaseAddress/3.0.0",
                          "comment": "Base URL of where NuGet packages are stored, in the format https://api.nuget.org/v3-flatcontainer/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg"
                      }, {
                          "@id": "http://proget.xxx.com/feeds/Release/{id}/{version}",
                          "@type": "PackageDetailsUriTemplate/5.1.0",
                          "comment": "URI template used by NuGet Client to construct details URL for packages"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/registrations/{id-lower}/index.json",
                          "@type": "PackageDisplayMetadataUriTemplate/3.0.0-rc",
                          "comment": "URI template used by NuGet Client to construct display metadata for Packages using ID"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/v3/registrations/{id-lower}/{version-lower}.json",
                          "@type": "PackageVersionDisplayMetadataUriTemplate/3.0.0-rc",
                          "comment": "URI template used by NuGet Client to construct display metadata for Packages using ID, Version"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/",
                          "@type": "LegacyGallery"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/",
                          "@type": "LegacyGallery/2.0.0"
                      }, {
                          "@id": "https://proget.xxx.com/nuget/Release/package",
                          "@type": "PackagePublish/2.0.0"
                      }
                  ]
              }
              

              here the PackageDetailsUriTemplate/5.1.0 type is using http instead of https

              1 Reply Last reply Reply Quote 0
              • atrippA Offline
                atripp inedo-engineer @viceice
                last edited by atripp

                The NuGet API does require absolute URLS to be returned, hence this behavior. And since the IP address changes (we check for local requests using HttpRequest.IsLocal, which basically just looks for 127.0.0.1), the license violation triggers.

                Instead of using the Web.BaseUrl property, you could configure your proxy to use the X-Forwarded-* headers. I attached the code for how the URL is constructed in ProGet, and how these headers work.

                    var baseUrl = ProGetConfig.Web.BaseUrl;
                    if (string.IsNullOrEmpty(baseUrl))
                    {
                        var request = HttpContextThatWorksOnLinux.Current?.Request;
                        if (request != null)
                        {
                            var requestUrl = request.Url;
                
                            var forwardedHost = request.Headers["X-Forwarded-Host"];
                            int? forwardedPort = AH.ParseInt(request.Headers["X-Forwarded-Port"]);
                            var forwardedProtocol = request.Headers["X-Forwarded-Proto"];
                
                            var host = AH.CoalesceString(forwardedHost, requestUrl.Host);
                            var protocol = AH.CoalesceString(forwardedProtocol, requestUrl.Scheme);
                            int port = forwardedPort ?? requestUrl.Port;
                
                            var uri = new UriBuilder(protocol, host, port);
                            if (uri.Uri.IsDefaultPort)
                                uri.Port = -1;
                
                            baseUrl = uri.ToString();
                            if (!baseUrl.EndsWith("/"))
                                baseUrl += "/";
                        }
                        else
                        {
                            baseUrl = "/";
                        }
                    }
                    else
                    {
                        baseUrl = baseUrl.TrimEnd('/') + "/";
                    }
                
                1 Reply Last reply Reply Quote 0
                • V Offline
                  viceice
                  last edited by

                  yes, I'm already passing the proxy headers and it basically works.

                  Only the PackageDetailsUriTemplate url in index.json now points to http instead of https. So i think there is a small bug.

                  1 Reply Last reply Reply Quote 0
                  • rhessingerR Offline
                    rhessinger inedo-engineer
                    last edited by

                    Hi @viceice,

                    Is your proxy passing X-Forwarded-Proto also? That should be passing https. You could try hard coding that in the proxy.

                    Thanks,
                    Rich

                    Products Engineer, Inedo

                    1 Reply Last reply Reply Quote 0
                    • V Offline
                      viceice
                      last edited by viceice

                      Yes, i think so, using traefik as reverse proxy.

                      as you can see in above posted json most urls look right, only PackageDetailsUriTemplate has http instead of https protocol.

                      I also see no new Licensing Violations since friday. Editing and saving license key does not remove the red banner.

                      1 Reply Last reply Reply Quote 0
                      • rhessingerR Offline
                        rhessinger inedo-engineer
                        last edited by

                        Hi @viceice,

                        Can you please confirm your connector URL contains the https? How is ProGet setup? Is it installed on windows? Are you using IIS? It might be easier to add an SSL binding in IIS for this as well.

                        Thanks,
                        Rich

                        Products Engineer, Inedo

                        1 Reply Last reply Reply Quote 0
                        • V Offline
                          viceice
                          last edited by viceice

                          I'm using the docker linux version with default settings. then i added traefik as https reverse proxy with ssl ofload. it will pass the normal X-Forwarded- http headers, which seem to work correct.

                          if i download the index.json only one of the urls is missing the https prefix and uses http. So because only one url is wrong i assume a bug on the PackageDetailsUriTemplate url generation.

                          1 Reply Last reply Reply Quote 0
                          • rhessingerR Offline
                            rhessinger inedo-engineer
                            last edited by

                            Hi @viceice,

                            Thanks for the clarification on your environment! I see what is going on now. I have created a ticket, PG-1809, to track the fix for this. We expect this to be released in ProGet 5.3.11 which we are expecting to be released in September 11, 2020. Basically in that instance, we are not respecting the values within the X-Forwarded-* headers. I'll let you know if anything changes on the timeline.

                            Thanks,
                            Rich

                            Products Engineer, Inedo

                            1 Reply Last reply Reply Quote 1

                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                            With your input, this post could be even better 💗

                            Register Login
                            • 1 / 1
                            • First post
                              Last post
                            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation