Advertisement
Guest User

NPM-config

a guest
May 15th, 2025
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.48 KB | None | 0 0
  1. # Increase buffer size for large headers
  2. # This is needed only if you get 'upstream sent too big header while reading response
  3. # header from upstream' error when trying to access an application protected by goauthentik
  4. proxy_buffers 8 16k;
  5. proxy_buffer_size 32k;
  6.  
  7. location / {
  8.     # Put your proxy_pass to your application here
  9.     proxy_pass          $forward_scheme://$server:$port;
  10.  
  11.     # authentik-specific config
  12.     auth_request        /outpost.goauthentik.io/auth/nginx;
  13.     error_page          401 = @goauthentik_proxy_signin;
  14.     auth_request_set $auth_cookie $upstream_http_set_cookie;
  15.     add_header Set-Cookie $auth_cookie;
  16.  
  17.     # translate headers from the outposts back to the actual upstream
  18.     auth_request_set $authentik_username $upstream_http_x_authentik_username;
  19.     auth_request_set $authentik_groups $upstream_http_x_authentik_groups;
  20.     auth_request_set $authentik_email $upstream_http_x_authentik_email;
  21.     auth_request_set $authentik_name $upstream_http_x_authentik_name;
  22.     auth_request_set $authentik_uid $upstream_http_x_authentik_uid;
  23.  
  24.     proxy_set_header X-authentik-username $authentik_username;
  25.     proxy_set_header X-authentik-groups $authentik_groups;
  26.     proxy_set_header X-authentik-email $authentik_email;
  27.     proxy_set_header X-authentik-name $authentik_name;
  28.     proxy_set_header X-authentik-uid $authentik_uid;
  29. }
  30.  
  31. # all requests to /outpost.goauthentik.io must be accessible without authentication
  32. location /outpost.goauthentik.io {
  33.     proxy_pass          http://<authentic-server-ip>:9000/outpost.goauthentik.io;
  34.     # ensure the host of this vserver matches your external URL you've configured
  35.     # in authentik
  36.     proxy_set_header    Host $host;
  37.     proxy_set_header    X-Original-URL $scheme://$http_host$request_uri;
  38.     add_header          Set-Cookie $auth_cookie;
  39.     auth_request_set    $auth_cookie $upstream_http_set_cookie;
  40.  
  41.     # required for POST requests to work
  42.     proxy_pass_request_body off;
  43.     proxy_set_header Content-Length "";
  44. }
  45.  
  46. # Special location for when the /auth endpoint returns a 401,
  47. # redirect to the /start URL which initiates SSO
  48. location @goauthentik_proxy_signin {
  49.     internal;
  50.     add_header Set-Cookie $auth_cookie;
  51.     return 302 /outpost.goauthentik.io/start?rd=$request_uri;
  52.     # For domain level, use the below error_page to redirect to your authentik server with the full redirect path
  53.     # return 302 https://authentik.company/outpost.goauthentik.io/start?rd=$scheme://$http_host$request_uri;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement