New to caddy, help setup proxy

(Balajeek) #1

I am new to Caddy and need help in getting the config right.
(Note, new user are allowed only 4 links so i am removing // in my urls)

i have a free dns sean.site.net and have been running my own tt-rss on this dns and i also have “Home Assistant” app running on port 8123. Both works fine when i had apache2. My idea to move to caddy is becaz of auto https, so i would SSL sean.site.net as a main site on port 80 and use sub folders to proxy other apps like “home assistant” and few more i am planning.

First step i am trying without SSL to make everything work.

Goal is when i hit
http:sean.site.net - will access my tt-rss
http:sean.site.net/hass - will access home assistant on localhost:8123
http:sean.site.net/app2 - will be another future app.

The config i wrote for caddy is this:

http://sean.site.net {
    root /var/www/tt-rss
    gzip
    tls off

    fastcgi / /var/run/php/php7.0-fpm.sock {
        index index.php
    }
}

http://sean.site.net/hass {
    proxy / localhost:8123 {
        websocket
        transparent
    }
}

Now the first site tt-rss works fine, the second site /hass starts up but it gets redirected to its login page like this http:sean.site.net/auth/login which should be http:sean.site.net/hass/auth/login
and any subsquent pages missing the /hass subfolder name making it inaccessible.

What am I doing wrong?
thanks in advance.

(Matthew Fay) #2

Hi @balajeek, welcome to the Caddy community!

I edited your comment to put your Caddyfile in code blocks (triple backticks, ```) for readability. Putting URLs in code blocks doesn’t count towards link spam, too.

Your Caddyfile configuration looks good. This is a universal problem, not any mistake on your part. I’ve had plenty of opportunities over time to write about this issue on these forums, actually. Here’s a recent one that explains the problem as another poster encountered it:

Have a read of that post - the rest the thread also has some useful information - and post back if you’ve got any questions.

1 Like
(Balajeek) #3

since i am reading that you could do with sub domains, i preferred to take that route instead of sub folders trying to fiddle with and not working so far. I had a domain with me for sometime i haven’t used and thought will make use of it.

here is my domain let say
~~~ http://wbcorners.com ~~~

So my new goal is

wbcorners.com  - will access a single page site on port 80
hass.wbcorners.com - will access home assistant on localhost:8123
app2.wbcorners.com - will be another future app.

I went to godaddy dns and added appropriate subdomains.

my caddy config is like:

http://wbcorners.com {
    root /var/www/localhost
    gzip
}

http://app2.wbcorners.com {
    root /var/www/app2
    gzip
    tls off
}

http://hass.wbcorners.com {
    proxy / localhost:8123 {
        websocket
        transparent
    }
}

but all site goes to my default first site wbcorners.com
what am I missing, doesn’t caddy know what url coming from?

(Balajeek) #4

followup to that

after adding the subdomains do i need to add cname record too in godaddy settings?

(Balajeek) #5

Update:

I figured out, that i was doing wrong in godaddy domain setup, I spoke with them and they simply created a A record with the host name instead.

now all 3 sites are pointing to where i wanted it and caddy handles it well pointing to the right sites.

but i am not done yet, becaz for some reason the tt-rss site (you know tiny tiny rss) is able to show but without style sheet applied and looks wierd, still have to figure out why though.

(Matthew Fay) #6

What’s in your Caddyfile for tt-rss?