Giter Site home page Giter Site logo

Configuration Help about caddy-l4 HOT 6 CLOSED

mholt avatar mholt commented on September 28, 2024
Configuration Help

from caddy-l4.

Comments (6)

gt2416 avatar gt2416 commented on September 28, 2024 2

Sure, I had to add another matcher so that it knows what subdomain to listen for.
So the config ended up being

"layer4": {
			"servers": {
				"srv0": {
					"listen": [
						":443"
					],
					"routes": [
						{
							"match": [
								{
									"host": [
										"ssh.mydomain.com"
									]
								}
							],
							"match": [
								{
									"ssh": {}
								}
							],
							"handle": [
								{
									"handler": "proxy",
									"upstreams": [
										{
											"dial": [
												"192.168.0.11:22"
											]
										}
									]
								}
							]
						}
					]
				}
			}
		}

from caddy-l4.

ThisIsTenou avatar ThisIsTenou commented on September 28, 2024 1

NVM, I figured it out, You can close this !

Mind sharing the solution with us in case others stumble upon the same issue?

from caddy-l4.

gt2416 avatar gt2416 commented on September 28, 2024

NVM, I figured it out, You can close this !

from caddy-l4.

mholt avatar mholt commented on September 28, 2024

@gt2416 Hmm, that's odd. There is no host matcher in layer4, without the http matcher first. And you have two match keys where one is overriding the other (second is kept).

I suspect you did something else different to make it work.

from caddy-l4.

gt2416 avatar gt2416 commented on September 28, 2024

If I remove that matcher it stops working, however I know it is not matching anything. Its just that the ssh.mydomain.com isnt there anywhere else in the file.
If I try adding a second block with ssh2.mydomain.com to proxy to ip2, it lets me ssh but goes to proxy ip1 (the one defined for ssh.mydomain.com) so yea Im def doing something weird.
Like I said I don't know how to use json, what I do is write my caddy file, copy the json from the autosave location and add this layer4 code block at the end. My json file is 650lines, I dont plan to learn to use it completely lol, caddyfile is a lot easier.
How would I go about doing this, ssh.mydomain.com -- IP1, ssh2.mydomain.com --IP2 ?

from caddy-l4.

mholt avatar mholt commented on September 28, 2024

If I remove that matcher it stops working, however I know it is not matching anything. Its just that the ssh.mydomain.com isnt there anywhere else in the file.

Sure, but that shouldn't affect SSH, which doesn't use HTTP or TLS.

Like I said I don't know how to use json, what I do is write my caddy file, copy the json from the autosave location and add this layer4 code block at the end.

Instead of using autosave, use the caddy adapt command.

ssh.mydomain.com -- IP1, ssh2.mydomain.com --IP2 ?

I'm not sure what you mean. SSH doesn't distinguish hostnames like HTTP does.

from caddy-l4.

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.