Docker-compose | nodejs | websocket issue

1. Caddy version (caddy version):

2.4.6

2. How I run Caddy:

CaddyFile / Docker Files

a. System environment:

3. The problem I’m having:

I tried to exec into the docker container running place, and ruin curl -v yet it said missing a domain so i got lost not gonna lie. I am quite new to linux, and web server wise. Trying to get my toes deep in the sand if you know what i mean.
The code to the website is open source and can be seen below for certain parts easily.

I had the site running perfectly without caddy at first, but wanted to switch to caddy because of the auto https which ive never been able to get working. The website works in some parts but not in others which is weird. You can login and place pixels yet nothing else works for some reason. I get the to many redirections error in the web browser console and thats all ive seen. i have debug mode enabled for caddy but dont see anything out of the ordinary.

[Caddy Debug Logs]

HTTP Server
WebSocket Server

4. Error messages and/or full log output:

Place Logs

5. What I already tried:

I’ve honestly been trying to fix this for days now. i cant remember every single fix. i went to the community discord as well but they told me to go here. ive tried reconfiguring the caddy file in many different ways, i added the method POST in the picture for testing but removed it as it didnt work, and just cant figure it out.

6. Links to relevant resources:

Hi,

Welcome to the forums. Can you please post your configs and logs as text instead of images? We can’t easily reason about images because we can’t format them, copy the text, etc. It’s also extremely hard to read on mobile.

Can you also please post curl -v commands that replicate your problems (and their full outputs)?

I mentioned that I didn’t quite know how to work curl -v commands if you could give a short run down on what you mean post the commands. , and i use all of this through VMWare remote console where i can’t copy/paste from so it was easier to take pictures of. i can try and transfer over some files, just dont have ftp setup for this server either. I figured the picture would of been fine for a read over, as i understand you cant format / copy text but short words should get the point across for what you are trying to say. I’ll start seeing if i can easily get all the files over rq, but how do i go about doing curl -v things?

curl is a command which makes an HTTP request, from command-line. The -v flag means “verbose”, which prints out the HTTP headers, which is helpful to see what’s actually going on. Run curl -v https://example.com/some/path in your terminal (obviously, replace the domain/path with whatever’s relevant for your app)

VMWare should have a feature to sync the clipboard to your host machine. Or you could open a browser in your VM maybe and make your forum post from inside the VM (assuming it’s a VM with a graphical desktop).

Either way, posting screenshots puts the burden on us to transcribe anything we want to comment on, instead of being to just quote reply on text, or copy-paste and make simple modifications to what you pasted to suggest a change. It’s a waste of our time to try to transcribe things.

I completely understand, ive been very busy as today has went to lowkey crap. back to the topic though, i havent used caddy-git and plan to remove it here soon.

Caddyfile

{
	debug
	email email.com
	acme_dns cloudflare 
}

*.itzdabbzz.me, itzdabbzz.me {
	tls {
		dns cloudflare 
	}
	
	reverse_proxy main:3005

	@place host place.itzdabbzz.me 
	handle @place {
		reverse_proxy * place:3100

		@websockets {
			header Connection *Upgrade*
			header Upgrade websocket
		}
		reverse_proxy @websockets place:3100


		@api {
			header Connection *Upgrade*
			header Upgrade websocket
		}
		reverse_proxy @api place:3101
	}

docker-compose.yml

version: "3.7"

networks:
  web:
    external: true
  internal:
    external: false
    driver: bridge

services:
  caddy:
    build: .
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /mnt/caddy/sites/Caddyfile:/etc/caddy/Caddyfile
      - /mnt/caddy/data:/data # Optional
      - /mnt/caddy/config:/config # Optional
    environment:
      CF_API_TOKEN: ""
    networks:
      - web
      - internal

   main:
    restart: always
    build: 
      context: ../sites/main/
      dockerfile: ./Dockerfile
    ports:
      - "127.0.0.1:3005:3005"
    depends_on:
      - "caddy"
    environment:
      NODE_ENV: "production"
      PORT: 3005
      ONLY_LISTEN_LOCAL: "false"
      URL: "https://itzdabbzz.me"
    networks:
      - internal

  place:
    restart: always
    build: 
      context: ../sites/place/
      dockerfile: ./Dockerfile
    ports:
      - "127.0.0.1:3100:3100"
      - "127.0.0.1:3101:3101"
    depends_on:
      - "caddy"
      - "db"
    volumes:
      - ../sites/place:/place
      - place:/place/node_modules
    environment:
      NODE_ENV: "production"
      DATABASE: "mongodb"
      PORT: 3100
      ONLY_LISTEN_LOCAL: "false"
      URL: "https://place.itzdabbzz.me"
    networks:
      - internal

Dockerfile

FROM caddy:2.4.6-builder AS builder
RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare \
    --with github.com/greenpau/caddy-git 

FROM caddy:2.4.6
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
WORKDIR /sites/
COPY /sites/Caddyfile /etc/caddy/Caddyfile
1 Like

Thanks for the text, that’s way more helpful.

Can you go into more detail?

We’ll likely need a curl -v command showing us the request that is malfunctioning. You can get this from your browser by opening the dev tools, going to the network tab, (refresh the page if it’s empty), then right-click on the request that has the problem and click “Copy as curl” (or something like that).

Then run that curl command in your terminal (with -v added to print more info) and paste the command and its output here on the forum.

I’ll guess right away though that it’s your backend that’s issuing redirects because it doesn’t know it’s behind a reverse proxy.

Here is the curl output

the program itself does have a proxy trust level from express

Place Config

root@b74f47953e2d:/place# curl -v https://place.itzdabbzz.me
* Rebuilt URL to: https://place.itzdabbzz.me/
*   Trying 104.21.50.226...
* TCP_NODELAY set
* Connected to place.itzdabbzz.me (104.21.50.226) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=sni.cloudflaressl.com
*  start date: Jun 11 00:00:00 2021 GMT
*  expire date: Jun 10 23:59:59 2022 GMT
*  subjectAltName: host "place.itzdabbzz.me" matched cert's "*.itzdabbzz.me"
*  issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x56032c272da0)
> GET / HTTP/1.1
> Host: place.itzdabbzz.me
> User-Agent: curl/7.52.1
> Accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200 
< date: Thu, 21 Apr 2022 04:14:46 GMT
< content-type: text/html; charset=utf-8
< set-cookie: session=eyJjc3JmU2VjcmV0IjoiY2hFNERKb3J4TXo5SVhNQUJQclNCZmpJIn0=; path=/; httponly
< set-cookie: session.sig=-Tbnq4wR6VGuk5zQuyrQ83CbHSw; path=/; httponly
< strict-transport-security: max-age=15552000; includeSubDomains
< x-content-type-options: nosniff
< x-dns-prefetch-control: off
< x-download-options: noopen
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< cf-cache-status: DYNAMIC
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=pTOoKG6x15dQKDZWeQajFT5nYISRDguFZWJ9oWdDjgVsxM2%2Fd0zHjbs17STkJJ3o58pW%2FitvFpMVSvZugtWYhFMNAh3AihZdHS%2BXwAUldtGVD%2Bb3DuRGCBlryeToSrZxZ4FL2F0%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: 6ff34b759fdb0bff-DFW
< alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
< 
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"><title>Rick Sanchez - Pixel (debug)</title><!-- Icons and web app config--><link rel="apple-touch-icon" href="/img/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png?n=1"><link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png?n=1"><link rel="icon" type="image/png" sizes="96x96" href="/img/favicon-96x96.png?n=1"><link rel="icon" type="image/x-icon" sizes="16x16" href="/img/favicon.ico?n=1"><link rel="shortcut icon" type="image/x-icon" sizes="16x16" href="/img/favicon.ico?n=1"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="default"><!-- OpenGraph + Twitter meta tags--><meta property="og:title" content="Rick Sanchez - Pixel"><meta property="og:url" content="https://place.itzdabbzz.me"><meta property="og:image" content="/img/apple-touch-icon.png"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="Rick Sanchez - Pixel"><meta property="twitter:image" content="/img/apple-touch-icon.png"><meta property="og:description" content="Work together to create something amazing. Join thousands of other users and see what happens when you share one huge canvas."><meta property="twitter:description" content="Work together to create something amazing. Join thousands of other users and see what happens when you share one huge canvas."><!-- Unrelated meta tags--><meta name="csrf-token" content="R3fDya61-UvMslgLRWdrp0t9Rt28p3v7vnQw"><meta name="place-site-name" content="Rick Sanchez - Pixel"><!-- Hard CSS--><link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet"><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><script src="https://kit.fontawesome.com/d3971db808.js"></script><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"><!-- Provided CSS--><link href="/css/global.css?v=10" rel="stylesheet"><link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.0.0/css/bootstrap-slider.min.css?v=10" rel="stylesheet"><link href="https://cdn.jsdelivr.net/jquery.minicolors/2.1.2/jquery.minicolors.css?v=10" rel="stylesheet"><link href="/css/place.css?v=10" rel="stylesheet"><!-- Shivs--><!--[if lt IE 9]><script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script><script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]--></head><body class="fixed-navbar" data-user-is-mod="false" data-user-is-reg="false" data-user-is-admin="false" data-user-id=""><nav class="navbar navbar-default navbar-fixed-top" id="page-nav"><div class="container"><!-- Brand and toggle get grouped for better mobile display--><div class="navbar-header"><button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a class="navbar-brand" href="http://dashboard.itzdabbzz.me:86" style="margin-right: -5px"><img src="https://assets.dynastic.co/brand/img/icon-46.png" height="20"></a><a class="navbar-brand" href="/">Rick Sanchez - Pixel<span class="label label-danger beta-label">debug</span></a></div><div class="collapse navbar-collapse" id="navbar-collapse"><ul class="nav navbar-nav"><li class="active" id="nav-home"><a href="/"><i class="fa fa-fw fa-home"></i><span>Home</span><span class="sr-only">(current)</span></a></li><li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-users fa-fw"></i>Community <span class="caret"></span></a><ul class="dropdown-menu"><li id="nav-chat-on-discord"><a href="https://discord.gg/VSWnA8URsv"><i class="fa fa-fw fa-comments"></i><span>Chat on Discord</span></a></li><li id="nav-source-code"><a href="https://www.github.com/ItzDabbzz/place"><i class="fa fa-fw fa-github"></i><span>Source Code</span></a></li><li id="nav-uptime"><a href="https://uptime.itzdabbzz.me"><i class="fa fa-fw fa-heartbeat"></i><span>Uptime</span></a></li></ul></li></ul><ul class="nav navbar-nav navbar-right"><li id="nav-auth-link"><a class="btn btn-sm btn-nav-auth-link" href="javascript:void(0)" data-place-trigger="openAuthDialog">Get Started</a></li><li id="nav-help"><a href="javascript:void(0)"><i class="fa fa-fw fa-question-circle"></i><span class="visible-xs-inline">Help</span></a></li></ul></div></div></nav><main><!-- Content-insertion point--><div id="floating-alert-ctn"></div><div id="place"><div id="loading"><div class="content"><img class="icon" src="https://assets.dynastic.co/brand/img/icon-256.png" height="75"><span class="text">Loading…</span></div></div><div class="canvas-container"><div id="pixel-data-ctn"><div class="pixel-data"><div class="summary"><span class="intro">Pixel placed by</span><div class="contents"><div class="user-summary"><div class="username-container"><div class="username-text-ctn"><a class="username" id="pixel-data-username"></a> <div id="user-actions-dropdown-ctn"></div></div></div><div class="rank-container"></div><time class="timeago" id="pixel-data-time"></time></div><div class="pixel-coordinates"><div class="contents"><div class="field"><span class="title">X</span><span class="value" id="pixel-data-x"></span></div><div class="field"><span class="title">Y</span><span class="value" id="pixel-data-y"></span></div></div></div></div></div><div class="pixel-colour clearfix"><div class="left field colour-info"><span class="title">HEX</span><span class="value"><span id="pixel-colour-code"></span> <div class="colour-preview" id="pixel-colour-preview"></div></span></div><div class="lett field colour-info-rgb"><span class="title">RGB</span><span class="value"><span id="pixel-colour-code-rgb"></span> <div class="colour-preview-rgb" id="pixel-colour-preview-rgb"></div></span></div><div class="right"><a class="btn btn-popping btn-arrow" id="pixel-use-colour-btn">Use</a></div></div><div class="user-info"></div></div></div><div class="button-ctn"><div class="popout-btns"><div class="popout-control control btn btn-default" data-tab-name="chat"><i class="fa fa-comments fa-fw"></i></div><div class="popout-control control btn btn-default" data-tab-name="leaderboard"><i class="fa fa-trophy fa-fw"></i></div><div class="popout-control control btn btn-default" data-tab-name="active-users"><i class="fa fa-users fa-fw"></i></div></div><div class="control-btns"><div class="control btn btn-success" id="grid-button"></div><div class="btn-group" role="group" aria-label="Zoom"><div class="control btn btn-primary" id="zoom-button"></div><div class="control btn btn-primary" id="zoom-slider-ctn"><input id="zoom-slider" data-slider-id="zoomSlider" type="text" data-slider-tooltip="hide"></div></div></div></div><div id="colour-picker-popover-ctn"></div><div id="colour-picker-popover"><style id="popover-styling"></style><div id="colour-picker"></div><div class="colour-info field"><span class="title">Hex</span><input class="value" id="colour-picker-hex-value" value="#D66668" maxlength="7" autocomplete="off" autocorrect="off" autocapitalizae="off" spellcheck="false" tabindex="-1"></div></div><!--colour-picker-popoverstyle#popover-styling
#colour-picker-rgb
.colour-info.field
    span.title RGB
    input.value#colour-picker-rgb-value(value="0,0,0", maxlength="15", autocomplete="off", autocorrect="off", autocapitalizae="off", spellcheck="false", tabindex="-1")--><div id="grid"></div><div id="grid-hint"></div><div id="palette-ctn"><div class="ctn-row"><div class="content compact"><div class="section clickable" id="user-count" style="display: none;"><i class="fa fa-user fa-fw"></i><span class="count"></span><i class="fa fa-circle-o-notch fa-spin fa-fw loading"></i></div><button class="section" id="coordinates" style="display: none;"><i class="fa fa-map-marker fa-fw"></i>(<span></span>, <span></span>)</button></div></div><div class="ctn-row"><div class="content" id="palette"><div id="menu-content-ctn"><div class="menu-section"><span class="menu-heading">Templates</span><div id="templates-ctn">Loading templates…</div></div><div class="menu-section"><span class="menu-heading">Warps</span><div id="warps-ctn">Loading warps…</div></div></div><div id="palette-content-ctn"><div class="overlay" id="sign-in-reminder"><span><a id="overlay-sign-in" data-place-trigger="openSignInDialog" href="javascript:void(0)">Sign in</a> or <a id="overlay-sign-up" data-place-trigger="openSignUpDialog" href="javascript:void(0)">sign up</a> to start placing!</span></div><div class="overlay" id="placing-modal">Placing…</div><div class="overlay" id="place-timer"><span></span></div><div class="overlay" id="availability-loading-modal"></div></div></div></div></div><canvas id="place-canvas" height="100%" width="100%"></canvas><div id="zoom-controller"><div id="camera-controller"><div id="template-images"></div><canvas id="place-canvas-draw" height="5000" width="5000"></canvas></div></div></div><div id="popout-container"><div class="navigation-bar"><span class="title"></span><div class="buttons"><span class="popout-btn" aria-label="Popout">&#x2197;</span><span class="close-btn" aria-label="Close">&times;</span></div></div><div class="content-ctn"><div class="tab-content active chat" data-tab-name="chat"><div class="messages" id="chat-messages"></div><div class="text-field"><input id="chat-input-field" type="text" maxlength="249" autocomplete="off" placeholder="Send a message" tabindex="-1"><a class="send-btn" id="chat-send-btn" href="javascript:void(0)">Send</a></div></div><div class="tab-content" id="leaderboardTab" data-tab-name="leaderboard"><div class="coming-soon"><p>Loading…</p></div></div><div class="tab-content" id="activeUsersTab" data-tab-name="active-users"><div class="coming-soon"><p>Loading…</p></div></div></div><div class="tabbar"><div class="tab active" data-tab-name="chat" title="Chat"><i class="fa fa-comments"></i></div><div class="tab" data-tab-name="leaderboard" title="Leaderboard"><i class="fa fa-trophy"></i></div><div class="tab" data-tab-name="active-users" title="Active Users"><i class="fa fa-users"></i></div></div></div></div><div class="dialog-ctn"><div class="dialog-overlay"></div><div class="dialog" id="sign-in-dialog"><div class="close">&times;</div><div class="pages"><div class="active" tab-name="sign-up"><div class="heading"><span class="site">Rick Sanchez - Pixel</span><h1>Become a member</h1><p class="subhead">Join the Rick Sanchez - Pixel community today to start placing.</p></div><form class="form-signin" action="/signup"><label class="sr-only" for="inputUsernameRegistration">Username</label><input class="form-control" id="inputUsernameRegistration" type="text" autocomplete="username" placeholder="Username" name="username" required autofocus autocorrect="off" autocapitalize="off" spellcheck="false"><label class="sr-only" for="inputPasswordRegistration">Password</label><input class="form-control form-merge-top" id="inputPasswordRegistration" type="password" autocomplete="new-password" placeholder="Password" name="password" required><label class="sr-only" for="inputPasswordRegistration2">Password (again)</label><input class="form-control form-merge-bottom" id="inputPasswordRegistration2" type="password" autocomplete="new-password" placeholder="Password (again)" name="passwordverify" required><div class="checkbox"><label><input type="checkbox" name="agreeToGuidelines"><span>I agree to abide by the <a href="/tos">Terms of Service</a>.</span></label></div><div class="checkbox"><label><input type="checkbox" name="keepSignedIn" checked><span>Keep me signed in</span></label></div><div class="send-section"><button class="btn btn-popping" type="submit">Sign Up</button><div class="separator"></div><div class="oauth-buttons"><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-google" href="/auth/google" title="Sign in with Google"><span class="fa fa-google"></span></a><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-discord" href="/auth/discord" title="Sign in with Discord"><span class="fa fa-discord"></span></a><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-github" href="/auth/github" title="Sign in with GitHub"><span class="fa fa-github"></span></a><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-microsoft" href="/auth/steam" title="Sign in with Steam account"><span class="fa fa-steam"></span></a><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-microsoft" href="/auth/twitch" title="Sign in with Twitch account"><span class="fa fa-twitch"></span></a></div></div></form></div><div tab-name="sign-in"><div class="heading"><span class="site">Rick Sanchez - Pixel</span><h1>Welcome back</h1><p class="subhead">Sign in to your account to continue placing and save your stats.</p></div><form class="form-signin" action="/signin"><label class="sr-only" for="inputUsername">Username</label><input class="form-control" id="inputUsername" type="text" autocomplete="username" placeholder="Username" name="username" required autofocus autocorrect="off" autocapitalize="off" spellcheck="false"><label class="sr-only" for="inputPassword">Password</label><input class="form-control" id="inputPassword" type="password" autocomplete="current-password" placeholder="Password" name="password" required><div class="checkbox"><label><input id="inputKeepSignIn" type="checkbox" name="keepSignedIn" checked><span>Keep me signed in</span></label></div><div class="send-section"><button class="btn btn-popping" type="submit">Sign in</button><div class="separator"></div><div class="oauth-buttons"><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-google" href="/auth/google" title="Sign in with Google"><span class="fa fa-google"></span></a><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-discord" href="/auth/discord" title="Sign in with Discord"><span class="fa fa-discord"></span></a><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-github" href="/auth/github" title="Sign in with GitHub"><span class="fa fa-github"></span></a><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-microsoft" href="/auth/steam" title="Sign in with Steam account"><span class="fa fa-steam"></span></a><a class="btn btn-popping btn-popping-alt btn-oauth btn-oauth-microsoft" href="/auth/twitch" title="Sign in with Twitch account"><span class="fa fa-twitch"></span></a></div></div></form></div><div class="hides-switchers" tab-name="2fa-auth"><div class="heading"><span class="site">Rick Sanchez - Pixel</span><h1>Two-factor Authentication</h1><p class="subhead">This account is secured with two-factor authentication. To continue, enter the token from your two-factor authentication app.</p></div><form class="form-signin" action="/signin"><input class="form-control" id="inputUsername2FA" type="hidden" name="username"><input class="form-control" id="inputPassword2FA" type="hidden" name="password"><input id="inputKeepSignIn2FA" type="checkbox" name="keepSignedIn" checked style="display: none;"><label class="sr-only" for="inputTotpToken">Authentication Token</label><input class="form-control" id="inputTotpToken" maxlength="6" inputmode="numeric" pattern="[0-9]{6}" name="totpToken" placeholder="Authentication Token" required autocorrect="off" autocapitalize="off" autocomplete="off" spellcheck="false"><div class="send-section"><button class="btn btn-popping" type="submit">Continue</button></div></form></div></div><div class="switchers"><div class="active" tab-name="sign-up"><div><div class="description"><span class="headline">Need an account?</span><span class="action-label">Sign up for an account</span></div><div class="call-to-action"><a class="btn btn-popping btn-arrow">Sign Up</a></div></div></div><div tab-name="sign-in"><div><div class="description"><span class="headline">Already a member?</span><span class="action-label">Sign in to your account</span></div><div class="call-to-action"><a class="btn btn-popping btn-arrow">Sign In</a></div></div></div></div></div></div><div class="dialog-ctn"><div class="dialog-overlay"></div><div class="dialog" id="help-dialog"><div class="close">&times;</div><div class="pages"><div class="active" tab-name="help"><div class="heading no-margin"><span class="site">Rick Sanchez - Pixel</span><h1>Get Help</h1><p class="subhead">Help using Rick Sanchez - Pixel.</p></div><div class="content"><h3>Getting an account</h3><p>You can sign in or create a Rick Sanchez - Pixel account by clicking Get Started in the top navigation bar. Once you do this, you can enter your current account details or create a new one. We also allow authentication through various third-party services, if you would prefer that.</p><h3>Placing pixels</h3><p>Placing pixels is easy. Pan over to the area you want to place the pixel, zoom in, select your colour by clicking on it in the palette, and click where you want to place it.</p><h3>Keyboard Controls</h3><p>You can use the following keyboard controls on Rick Sanchez - Pixel:</p><ul><li><kbd>G</kbd>: Toggle grid.</li><li><kbd>Space</kbd>: Toggle zoom in/out.</li><li><kbd>Esc</kbd>: Exit colour picker, exit dialog, deselect current colour.</li><li><kbd>P</kbd>: Select the current colour under your mouse pointer <em>(donors only)</em>.</li><li><kbd>&#x25B2; / W</kbd>: Pan upward</li><li><kbd>&#x25BC; / S</kbd>: Pan downward</li><li><kbd>&#x25C0; / A</kbd>: Pan to the left</li><li><kbd>&#x25B6; / D</kbd>: Pan to the right</li></ul><h3>Other topics</h3><p>If you need help with anything else, please <a href="https://discord.gg/CgC8FTg">join our Discord here</a> so we can help you out.</p></div></div></div><div class="dialog-footer align-end"><a class="btn btn-popping" data-dialog-dismiss>Close</a></div></div></div></main><!-- EU Cookie Banner--><div id="cookies-eu-banner" style="display: none;"><h4>Cookies on Rick Sanchez - Pixel</h4><p>By continuing your use of this service, you accept the use of cookies by Google Analytics to record generalized visit statistics. <a id="cookies-eu-more" href="/privacy" style="display: none">Learn more &raquo;</a></p><btn class="btn btn-success" id="cookies-eu-accept">Accept</btn> <btn class="btn btn-danger" id="cookies-eu-reject">Reject</btn></div></body></html><footer class="footer"><div class="container footer-contents"><div><p class="text-muted">&copy; ItzDabbzz Development</p></div><div class="right"><p><ul class="footer-links"><li><a href="/tos">Terms of Service</a></li></ul></p></div></div></footer><!-- Scripts--><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script><script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js?v=10"></script><script src="/js/cookies-eu-banner.min.js?v=10"></script><script src="/js/build/site.js?v=10"></script><script src="https://cdn.jsdelivr.net/interact.js/1.2.6/interact.min.js?v=10"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.0.0/bootstrap-slider.min.js?v=10"></script><script src="https://cdn.jsdelivr.net/jquery.minicolors/2.1.2/jquery.minicolors.min.js?v=10"></script><script src="https://cdn.jsdelivr.net/clipboard.js/1.6.0/clipboard.min.js?v=10"></script><script src="https://unpkg.com/eventemitter3@latest/umd/eventemitter3.min.js?v=10"></script><script src="* Curl_http_done: called premature == 0
* Connection #0 to host place.itzdabbzz.me left intact
/js/build/socket.js?v=10"></script><script src="/js/build/popout.js?v=10"></script><script src="/js/build/place.js?v=10"></script><script src="https://cdn.jsdelivr.net/gh/rmm5t/jquery-timeago@180864a9c544a49e43719b457250af216d5e4c3a/jquery.timeago.js?v=10"></script>root@b74f47953e2d:/place# 

Firefox on the vm the docker containers run on report Firefox can’t establish a connection to the server at wss://place.itzdabbzz.me/. i would also like to add.

heres curl without the https infront btw

curl -v place.itzdabbzz.me
*   Trying 2606:4700:3034::ac43:a7a6:80...
* TCP_NODELAY set
* Connected to place.itzdabbzz.me (2606:4700:3034::ac43:a7a6) port 80 (#0)
> GET / HTTP/1.1
> Host: place.itzdabbzz.me
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Date: Thu, 21 Apr 2022 05:15:35 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: max-age=3600
< Expires: Thu, 21 Apr 2022 06:15:35 GMT
< Location: https://place.itzdabbzz.me/
< Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=O%2F75ZWIvuufDI6WJmrkgbt8KMFvpR0WRPWvAD0F%2BwYmysHNX8HjZ11hRHyQK0YbbLN9RPvQBXXakeq%2Bnt1us%2FUmc0bVsOYkzBGU4iv1cfpBS5yjvJA1RESZvP2vFjc7eI1J5STr0LHBQ3VyXHvd1CNE%3D"}],"group":"cf-nel","max_age":604800}
< NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< Server: cloudflare
< CF-RAY: 6ff3a487bc5b03b4-ORD
< alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
< 
* Connection #0 to host place.itzdabbzz.me left intact

Can you explain what you need this to do, specifically? Right now, these matchers don’t make sense. You’re using identical matchers for two different upstreams. Which upstream actually handles websocket connections? What requests do you need to go to the other?

The second api matcher is for testing, trying to figure out why the websockets error was being thrown. I figured since the place application clarified that the websocket server was on 3101 that it would work but didn’t as it keeps throwing the unable to connect, yet whenever I remove the matcher from the websockets matcher I cant see the pixel board anymore so that’s required to be there for the board to work/load

Check your place container’s logs. It should say which ports it’s listening on.

It’s possible that websockets and HTTP are listening on the same port in your node app, if they’re using a shared server.

I added the links for the websocket server and HTTP server code in the OG post, they arent running on the same ports though. the Express server uses 3100 and the uWebSockets.js server uses 3101, thats why i was testing the matchers.

Alright, then just do this:

		@websockets {
			header Connection *Upgrade*
			header Upgrade websocket
		}
		reverse_proxy @websockets place:3101

		reverse_proxy place:3100

The weird thing about that, is it breaks the pixel board from loading is what I mentioned earlier. So websockets have to be sent to the 3100 too. which is weird to me but thats how it was designed .-. I just know it worked before i put it behind caddy if i used a regular port after my domain to connect it before caddy was installed n setup.

:man_shrugging:

That’s more of an issue with your application than with Caddy, it sounds like.

But Caddy can’t magically route the websocket requests to the right upstream, you need to tell it how to do that with a matcher. It depends how the requests look. Does one always use a URL path that the other doesn’t? Then you could add a path matcher to differentiate them.

This topic was automatically closed after 30 days. New replies are no longer allowed.