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

Document connecting to a reverse proxy #904

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/NATS.sln
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JetStreamPushSubscribeAsync
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimplificationQueue", "Samples\SimplificationQueue\SimplificationQueue.csproj", "{F8609197-D5B0-42CC-890E-921CAAA1589E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSReverseProxyExample", "Samples\TLSReverseProxyExample\TLSReverseProxyExample.csproj", "{98C52074-7693-48D4-B0A9-48920EEEDA24}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChaosTestApp", "Samples\ChaosTestApp\ChaosTestApp.csproj", "{649DEBB2-E0AC-47ED-AA39-B119F512C204}"
EndProject
Global
Expand Down Expand Up @@ -385,7 +383,6 @@ Global
{C7FB00D4-23F1-4F6A-A8C0-E58346F272DE} = {776C2E80-958B-4C0D-BCC4-67D39DB4570B}
{5DCD0666-5AC9-462F-99BD-5E8E95E4B749} = {776C2E80-958B-4C0D-BCC4-67D39DB4570B}
{F8609197-D5B0-42CC-890E-921CAAA1589E} = {776C2E80-958B-4C0D-BCC4-67D39DB4570B}
{98C52074-7693-48D4-B0A9-48920EEEDA24} = {776C2E80-958B-4C0D-BCC4-67D39DB4570B}
{649DEBB2-E0AC-47ED-AA39-B119F512C204} = {776C2E80-958B-4C0D-BCC4-67D39DB4570B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
4 changes: 2 additions & 2 deletions src/Samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ This folder contains a number of samples:
1. `Replier` - A sample replier for the Requestor application.
1. `RxSample` - Rx integration / functionality
1. `Subscribe` - A sample subscriber.
1. `WinFormsSample`
1. `TlsVariationsExample`
1. `WinFormsSample` - Use the client within a Windows application.
1. `TlsVariationsExample` - Some examples setting up the client for TLS
1. `JetStreamStarter` - A starter app for JetStream projects.

### Simplification
Expand Down
33 changes: 0 additions & 33 deletions src/Samples/TLSReverseProxyExample/CustomTCPConnection.cs

This file was deleted.

52 changes: 0 additions & 52 deletions src/Samples/TLSReverseProxyExample/TLSReverseProxyExample.cs

This file was deleted.

19 changes: 0 additions & 19 deletions src/Samples/TLSReverseProxyExample/TLSReverseProxyExample.csproj

This file was deleted.

36 changes: 36 additions & 0 deletions src/Samples/TlsVariationsExample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
![NATS](https://raw.githubusercontent.com/nats-io/nats.net/main/documentation/large-logo.png)

# TLS Variations

This project is simply some example code to jump start setting up TLS in the client.
There are also unit tests and corresponding configuration files which may be of use.

## Using a Reverse Proxy

In a reverse proxy configuration, the client connects securely to the reverse proxy
and the proxy may connect securely or insecurely to the server.

If the proxy connects securely to the server,
then there is nothing special required to do at all.

But most commonly, the proxy connects insecurely to the server.
This is where server configuration comes into play.
You will need to configure the server like so:

```
tls {}
allow_non_tls: true
```

Before this, the client would not connect
because the server was not requiring tls for the proxy,
but the client was configured as secure because it was connecting securely to the proxy.
The client thought that this was a mismatch and would not connect,
essentially failing fast instead of waiting for the server to reject the connection attempt.

The latest version of the client is able to recognize this server configuration
and understands that it's okay to connect securely to the proxy regardless of the
server configuration.

You just have to make sure you can properly connect securely to the proxy
and that's where the code in this sample comes in.
Loading