Files
goma-gateway/docs/middleware/basic.md

40 lines
595 B
Markdown
Raw Normal View History

2024-11-09 15:06:09 +01:00
---
title: Basic auth
layout: default
parent: Middleware
nav_order: 3
---
# Basic Auth Middleware
2024-11-20 07:57:15 +01:00
Basic-auth middleware protects route paths.
2024-11-09 15:06:09 +01:00
2024-11-20 07:57:15 +01:00
Example of basic-auth middleware
2024-11-09 15:06:09 +01:00
```yaml
2024-11-20 07:57:15 +01:00
middlewares:
- name: basic-auth
type: basic
2024-11-09 15:06:09 +01:00
paths:
2024-11-20 07:57:15 +01:00
- /admin/*
rule:
username: admin
password: admin
2024-11-09 15:06:09 +01:00
```
2024-11-20 07:57:15 +01:00
### Apply basic-auth middleware to the route
2024-11-09 15:06:09 +01:00
```yaml
routes:
2024-11-20 07:57:15 +01:00
- path: /
name: Basic-auth
2024-11-09 15:06:09 +01:00
rewrite: /
2024-11-20 07:57:15 +01:00
destination: https://example.com
2024-11-09 15:06:09 +01:00
methods: [POST, PUT, GET]
2024-11-20 07:57:15 +01:00
healthCheck: {}
2024-11-09 15:06:09 +01:00
cors: {}
middlewares:
2024-11-20 07:57:15 +01:00
- basic-auth
2024-11-09 15:06:09 +01:00
```