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

if enable jwtauth ,then caddy cannot start . #42

Closed
zuohuadong opened this issue May 5, 2023 · 6 comments
Closed

if enable jwtauth ,then caddy cannot start . #42

zuohuadong opened this issue May 5, 2023 · 6 comments

Comments

@zuohuadong
Copy link

zuohuadong commented May 5, 2023

host.xxx  {
      reverse_proxy  http://wapi.xxx
      jwtauth {
          sign_key 5bsddsdsd
          sign_alg HS256
          from_query access_token token
          from_header authorization
      }
}

directive 'jwtauth' is not an ordered HTTP handler, so it cannot be used here.

or

{
	order jwtauth before basicauth
}
host.xxx  {
      reverse_proxy  http://wapi.xxx
      jwtauth {
          sign_key 5bsddsdsd
          sign_alg HS256
          from_query access_token token
          from_header authorization
      }
}

adapting config using caddyfile: server block without any key is global configuration, and if used, it must be first

host.xxx  {
        route {
         order jwtauth before basicauth
       }
}

during parsing: unrecognized directive: order - are you sure your Caddyfile structure (nesting and braces) is correct?

How to Use it?

@zuohuadong zuohuadong changed the title if enbale jwtauth ,then caddy cannot start . if enable jwtauth ,then caddy cannot start . May 5, 2023
@ggicci
Copy link
Owner

ggicci commented May 5, 2023

The plugin should work as expected, please take a look at here, there's a tested Caddyfile.

@zuohuadong
Copy link
Author

@ggicci no . Whenever I start it, I see an error. Is it because of a conflict with caddy-git?

@ggicci
Copy link
Owner

ggicci commented May 6, 2023

{
	order jwtauth before basicauth
}
host.xxx  {
      
      jwtauth {
          sign_key 5bsddsdsd
          sign_alg HS256
          from_query access_token token
          from_header authorization
      }

      reverse_proxy  http://wapi.xxx
}

try this?

@ggicci
Copy link
Owner

ggicci commented May 12, 2023

Hi @zuohuadong have you got any updates on this?

@zuohuadong
Copy link
Author

@ggicci Sorry to get back to you now. I think I probably know the problem.

ERROR:

{
	order jwtauth before basicauth
}
{
        git  {
        ......
        }
}

right:

{
        order jwtauth before basicauth
        git  {
        ......
        }
}

@ggicci
Copy link
Owner

ggicci commented May 13, 2023

good to hear, then i'm gonna close this issue as it is related to Caddy configuration itself

@ggicci ggicci closed this as completed May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants