title: Linux ASP.Net core with Apache and reverse proxy
body: <p>I need to clarify the setup process of ASP.NET Core app on Linux. I have Apache as a server and I want to use it as a reverse proxy. On my ASP.NET Core app, I have such a setup:</p>
  
  <pre><code>services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
  services.Configure&lt;ForwardedHeadersOptions&gt;(options =&gt;
  {
      options.ForwardedHeaders =
          ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
  });
  </code></pre>
  
  
  
  <pre><code>app.UseForwardedHeaders(new ForwardedHeadersOptions
  {
      ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
  });
  </code></pre>
  
  <p>Forwarding headers - these were in documentation of "How to run ASP.NET Core on Linux".</p>
  
  <p>And in Program.cs I have:</p>
  
  <pre><code>var host = WebHost.CreateDefaultBuilder(args)
      .UseKestrel()
      .UseUrls("https://*:5001")
      .UseIISIntegration()
      .UseStartup&lt;Startup&gt;()
      .Build();
  </code></pre>
  
  <p>Questions I have:</p>
  
  <ol>
  <li>Do I need these Forwarded headers at all?</li>
  <li>Do I need to add <code>app.UseHttpsRedirection();</code> into my project?</li>
  <li>Do I need to specify <code>UseUrls("https://*:5001")</code> https in this line or it can be http?</li>
  <li>Do I need to have https in general on my Kestrel (my application), or if I have reverse proxy I can use http and Apache will take care of ssl?</li>
  <li>Do I need to have any other code in my ASP.NET Core app to make it works with reverse proxy?</li>
  </ol>