Giter Site home page Giter Site logo

Comments (3)

pregress avatar pregress commented on June 18, 2024 5

I Solved it by deploy a Proxy service for the Service fabric service, that handles the authentication for us.

private const int StreamCopyBufferSize = 81920;

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            // send every request to Service fabric api
            app.MapWhen(ctx => true, appBuilder =>
            {
                appBuilder.Run(async context =>
                {
                    var requestMessage = context.Request.ToHttpRequestMessage("localhost",19080);

                    try
                    {
                        var response = await Client.SendAsync(requestMessage);

                        using (var responseStream = await response.Content.ReadAsStreamAsync())
                        {
                            await responseStream.CopyToAsync(context.Response.Body, StreamCopyBufferSize, context.RequestAborted);
                        }
                    }
                    catch (Exception e)
                    {
                        await context.Response.WriteAsync(e.ToString());
                        context.Response.StatusCode = 500;
                    }
                });
            });
        }

        private static readonly HttpClient Client = new HttpClient(
            new HttpClientHandler
            {
                UseDefaultCredentials = true,
            })
            {
                BaseAddress = new Uri("http://localhost:19080")
            };

And I changed the clustermanagementurl to the new Proxy Service Url

from traefik-extra-service-fabric.

jjcollinge avatar jjcollinge commented on June 18, 2024

Please refer to this issue for more details.
In summary it's a known limitation of the integration, it only supports certificate authentication.

from traefik-extra-service-fabric.

tastyeggs avatar tastyeggs commented on June 18, 2024

To build on @pregress's answer, this is now even simpler with the Microsoft.AspNetCore.Proxy package (assuming you're using ASP.NET Core):

<PackageReference Include="Microsoft.AspNetCore.Proxy" Version="0.2" />
public class Startup
{
        public void ConfigureServices(IServiceCollection services)
        {

        }

        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.RunProxy(new ProxyOptions
            {
                Host = "localhost",
                Port = "19080",
                Scheme = "http",
                BackChannelMessageHandler = new HttpClientHandler() { UseDefaultCredentials = true }
            });
        }
    }

from traefik-extra-service-fabric.

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.