Code Monkey home page Code Monkey logo

Comments (5)

francislavoie avatar francislavoie commented on August 24, 2024

basicauth doesn't support single-line syntax with a username/password on the same line as the directives, you need to use a block instead. So do caddy.basicauth.mylogin: <password>

from caddy-docker-proxy.

sowinski avatar sowinski commented on August 24, 2024

great this works! But my password is not accepted. Is the way how I created the password correct?

But how can I just protect a specific folder or several folders like /admin/* and /cms/*

from caddy-docker-proxy.

francislavoie avatar francislavoie commented on August 24, 2024

Use the user/pass example here to confirm https://caddyserver.com/docs/caddyfile/directives/basicauth#examples, if that works then the problem isn't with how you're setting up the config but rather with the password you generated.

Simple path matching:

caddy.basicauth: /admin/*
caddy.basicauth.mylogin: <password>

But if you need to match multiple paths you'll need to use a named matcher. See the README for examples.

from caddy-docker-proxy.

sowinski avatar sowinski commented on August 24, 2024

My docker-compose line looks like that:

caddy.basicauth.Bob: "$2a$14$Zkx19XLiW6VYouLHR5NmfOFU0z2GTNmpkT/5qqR7hx4IjWJPDhjvG"
But I can not login with
user: Bob
pw: hiccup

Do I have to restart caddy or do something else?

I just restart my docker compose every time I change a line?

EDIT:
Escaping is necessary $ => $$ and just canceling was not enough. I use docker compose stop and down and then up and it worked.

What would be the correct way to reload the labels?

from caddy-docker-proxy.

francislavoie avatar francislavoie commented on August 24, 2024

up -d should be enough to make Docker Compose recognize the labels changed and recreate the relevant containers. You shouldn't need to down.

from caddy-docker-proxy.

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.