You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/host-and-deploy/linux-apache.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn how to set up Apache as a reverse proxy server on CentOS to r
4
4
author: spboyer
5
5
ms.author: spboyer
6
6
ms.custom: mvc
7
-
ms.date: 10/09/2018
7
+
ms.date: 10/23/2018
8
8
uid: host-and-deploy/linux-apache
9
9
---
10
10
# Host ASP.NET Core on Linux with Apache
@@ -51,13 +51,6 @@ Any component that depends on the scheme, such as authentication, link generatio
51
51
52
52
::: moniker range=">= aspnetcore-2.0"
53
53
54
-
> [!NOTE]
55
-
> Either configuration—with or without a reverse proxy server—is a valid and supported hosting configuration for ASP.NET Core 2.0 or later apps. For more information, see [When to use Kestrel with a reverse proxy](xref:fundamentals/servers/kestrel#when-to-use-kestrel-with-a-reverse-proxy).
56
-
57
-
::: moniker-end
58
-
59
-
# [ASP.NET Core 2.x](#tab/aspnetcore2x)
60
-
61
54
Invoke the [UseForwardedHeaders](/dotnet/api/microsoft.aspnetcore.builder.forwardedheadersextensions.useforwardedheaders) method in `Startup.Configure` before calling [UseAuthentication](/dotnet/api/microsoft.aspnetcore.builder.authappbuilderextensions.useauthentication) or similar authentication scheme middleware. Configure the middleware to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers:
Invoke the [UseForwardedHeaders](/dotnet/api/microsoft.aspnetcore.builder.forwardedheadersextensions.useforwardedheaders) method in `Startup.Configure` before calling [UseIdentity](/dotnet/api/microsoft.aspnetcore.builder.builderextensions.useidentity) and [UseFacebookAuthentication](/dotnet/api/microsoft.aspnetcore.builder.facebookappbuilderextensions.usefacebookauthentication) or similar authentication scheme middleware. Configure the middleware to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers:
If no [ForwardedHeadersOptions](/dotnet/api/microsoft.aspnetcore.builder.forwardedheadersoptions) are specified to the middleware, the default headers to forward are `None`.
[Clickjacking](https://blog.qualys.com/securitylabs/2015/10/20/clickjacking-a-common-implementation-mistake-that-can-put-your-websites-in-danger), also known as a *UI redress attack*, is a malicious attack where a website visitor is tricked into clicking a link or button on a different page than they're currently visiting. Use `X-FRAME-OPTIONS` to secure the site.
395
390
396
-
Edit the *httpd.conf* file:
391
+
To mitigate clickjacking attacks:
397
392
398
-
```bash
399
-
sudo nano /etc/httpd/conf/httpd.conf
400
-
```
393
+
1. Edit the *httpd.conf* file:
394
+
395
+
```bash
396
+
sudo nano /etc/httpd/conf/httpd.conf
397
+
```
401
398
402
-
Add the line `Header append X-FRAME-OPTIONS "SAMEORIGIN"`. Save the file. Restart Apache.
399
+
Add the line `Header append X-FRAME-OPTIONS "SAMEORIGIN"`.
400
+
1. Save the file.
401
+
1. Restart Apache.
403
402
404
403
#### MIME-type sniffing
405
404
@@ -479,4 +478,5 @@ The example file limits bandwidth as 600 KB/sec under the root location:
479
478
480
479
## Additional resources
481
480
481
+
*[Prerequisites for .NET Core on Linux](/dotnet/core/linux-prerequisites)
482
482
*[Configure ASP.NET Core to work with proxy servers and load balancers](xref:host-and-deploy/proxy-load-balancer)
Copy file name to clipboardExpand all lines: aspnetcore/host-and-deploy/linux-nginx.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ author: rick-anderson
4
4
description: Learn how to setup Nginx as a reverse proxy on Ubuntu 16.04 to forward HTTP traffic to an ASP.NET Core web app running on Kestrel.
5
5
ms.author: riande
6
6
ms.custom: mvc
7
-
ms.date: 10/09/2018
7
+
ms.date: 10/23/2018
8
8
uid: host-and-deploy/linux-nginx
9
9
---
10
10
# Host ASP.NET Core on Linux with Nginx
@@ -60,13 +60,6 @@ Test the app:
60
60
61
61
A reverse proxy is a common setup for serving dynamic web apps. A reverse proxy terminates the HTTP request and forwards it to the ASP.NET Core app.
62
62
63
-
::: moniker range=">= aspnetcore-2.0"
64
-
65
-
> [!NOTE]
66
-
> Either configuration—with or without a reverse proxy server—is a valid and supported hosting configuration for ASP.NET Core 2.0 or later apps. For more information, see [When to use Kestrel with a reverse proxy](xref:fundamentals/servers/kestrel#when-to-use-kestrel-with-a-reverse-proxy).
67
-
68
-
::: moniker-end
69
-
70
63
### Use a reverse proxy server
71
64
72
65
Kestrel is great for serving dynamic content from ASP.NET Core. However, the web serving capabilities aren't as feature rich as servers such as IIS, Apache, or Nginx. A reverse proxy server can offload work such as serving static content, caching requests, compressing requests, and SSL termination from the HTTP server. A reverse proxy server may reside on a dedicated machine or may be deployed alongside an HTTP server.
@@ -77,7 +70,7 @@ Because requests are forwarded by reverse proxy, use the [Forwarded Headers Midd
77
70
78
71
Any component that depends on the scheme, such as authentication, link generation, redirects, and geolocation, must be placed after invoking the Forwarded Headers Middleware. As a general rule, Forwarded Headers Middleware should run before other middleware except diagnostics and error handling middleware. This ordering ensures that the middleware relying on forwarded headers information can consume the header values for processing.
79
72
80
-
# [ASP.NET Core 2.x](#tab/aspnetcore2x)
73
+
::: moniker range=">= aspnetcore-2.0"
81
74
82
75
Invoke the [UseForwardedHeaders](/dotnet/api/microsoft.aspnetcore.builder.forwardedheadersextensions.useforwardedheaders) method in `Startup.Configure` before calling [UseAuthentication](/dotnet/api/microsoft.aspnetcore.builder.authappbuilderextensions.useauthentication) or similar authentication scheme middleware. Configure the middleware to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers:
Invoke the [UseForwardedHeaders](/dotnet/api/microsoft.aspnetcore.builder.forwardedheadersextensions.useforwardedheaders) method in `Startup.Configure` before calling [UseIdentity](/dotnet/api/microsoft.aspnetcore.builder.builderextensions.useidentity) and [UseFacebookAuthentication](/dotnet/api/microsoft.aspnetcore.builder.facebookappbuilderextensions.usefacebookauthentication) or similar authentication scheme middleware. Configure the middleware to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers:
If no [ForwardedHeadersOptions](/dotnet/api/microsoft.aspnetcore.builder.forwardedheadersoptions) are specified to the middleware, the default headers to forward are `None`.
114
109
@@ -327,7 +322,7 @@ sudo ufw enable
327
322
328
323
Edit *src/http/ngx_http_header_filter_module.c*:
329
324
330
-
```c
325
+
```
331
326
static char ngx_http_server_string[] = "Server: Web Server" CRLF;
332
327
static char ngx_http_server_full_string[] = "Server: Web Server" CRLF;
333
328
```
@@ -342,9 +337,9 @@ Configure the server with additional required modules. Consider using a web app
342
337
343
338
* Harden the security by employing some of the practices depicted in the following */etc/nginx/nginx.conf* file. Examples include choosing a stronger cipher and redirecting all traffic over HTTP to HTTPS.
344
339
345
-
* Adding an `HTTP Strict-Transport-Security` (HSTS) header ensures all subsequent requests made by the client are over HTTPS only.
340
+
* Adding an `HTTP Strict-Transport-Security` (HSTS) header ensures all subsequent requests made by the client are over HTTPS.
346
341
347
-
* Don't add the Strict-Transport-Security header or chose an appropriate `max-age` if SSL will be disabled in the future.
342
+
* Don't add the HSTS header or chose an appropriate `max-age` if SSL will be disabled in the future.
348
343
349
344
Add the */etc/nginx/proxy.conf* configuration file:
350
345
@@ -355,15 +350,20 @@ Edit the */etc/nginx/nginx.conf* configuration file. The example contains both `
Clickjacking is a malicious technique to collect an infected user's clicks. Clickjacking tricks the victim (visitor) into clicking on an infected site. Use X-FRAME-OPTIONS to secure the site.
359
353
360
-
Edit the *nginx.conf* file:
354
+
[Clickjacking](https://blog.qualys.com/securitylabs/2015/10/20/clickjacking-a-common-implementation-mistake-that-can-put-your-websites-in-danger), also known as a *UI redress attack*, is a malicious attack where a website visitor is tricked into clicking a link or button on a different page than they're currently visiting. Use `X-FRAME-OPTIONS` to secure the site.
361
355
362
-
```bash
363
-
sudo nano /etc/nginx/nginx.conf
364
-
```
356
+
To mitigate clickjacking attacks:
357
+
358
+
1. Edit the *nginx.conf* file:
359
+
360
+
```bash
361
+
sudo nano /etc/nginx/nginx.conf
362
+
```
365
363
366
-
Add the line `add_header X-Frame-Options "SAMEORIGIN";` and save the file, then restart Nginx.
364
+
Add the line `add_header X-Frame-Options "SAMEORIGIN";`.
0 commit comments