You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Configuration.md
+110
Original file line number
Diff line number
Diff line change
@@ -637,6 +637,116 @@ We also added an example(for unit testing) about this, in nginx.conf
637
637
638
638
The example java rewrite handler code can be found from https://github.com/nginx-clojure/nginx-clojure/blob/master/test/java/nginx/clojure/java/RewriteHandlerTestSet4NginxJavaRingHandler.java#L35
639
639
640
+
641
+
2.6 Nginx Access Handler
642
+
-----------------
643
+
644
+
Although we can do similar things within a rewrite handler but using Nginx Access Handler will further define roles of all kind of handlers.
645
+
Nginx Access Handler will run after Rewrite Handler and before Content Handler (e.g. general content ring handler , proxy_pass, etc.).
646
+
Access Handler has the same form with Rewrite Handler. When it returns `PHASE_DONE`, nginx will continue the next phase otherwise nginx will response
647
+
directly typically with some error information , e.g. `401 Unauthorized`, `403 Forbidden` .
648
+
e.g.
649
+
650
+
```nginx
651
+
652
+
location /basicAuth {
653
+
handler_type 'java';
654
+
access_handler_name 'my.BasicAuthHandler';
655
+
....
656
+
}
657
+
```
658
+
659
+
```java
660
+
661
+
/**
662
+
* This is an example of HTTP basic Authentication.
663
+
* It will require visitor to input a user name (xfeep) and password (hello!)
664
+
* otherwise it will return 401 Unauthorized or BAD USER & PASSWORD
0 commit comments