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

Use in Production? #11

Open
Trojaner opened this issue Sep 17, 2018 · 1 comment
Open

Use in Production? #11

Trojaner opened this issue Sep 17, 2018 · 1 comment

Comments

@Trojaner
Copy link

Would you recommend using this in production mode?

If you do so, are you planning to implement some kind of access control anytime soon?

@mayuki
Copy link
Owner

mayuki commented Sep 17, 2018

I don't recommend using Rin in a production environment for several reasons.

  1. Performance: Request capturing pays an overhead of memory and processor. The middlewares cause an application to slow down.
  2. Security: Currently, Rin doesn't have an access control feature. That may expose sensitive information.

However, I know some developers need to protect a development environment too. So, I planned to implement access control in the future.

At the moment, if you want to restrict access to Rin inspector, you can implement a workaround in the middleware pipeline.

Workaround

var options = app.ApplicationServices.GetService<RinOptions>();
app.MapWhen(
    ctx => ctx.Request.Path.StartsWithSegments(options.Inspector.MountPath) &&
           /* ctx.Request ...some conditions ... */,
    app2 =>
    {
        app2.Use((ctx, next) =>
        {
            ctx.Response.StatusCode = 403;
            ctx.Response.WriteAsync("Forbidden");
            return Task.CompletedTask;
        });
    });

app.UseRin();
...

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

2 participants