Authentication through nginx proxy returns 404

cancel
Showing results for 
Search instead for 
Did you mean: 
miroslav
Customer

Authentication through nginx proxy returns 404

Hello guys,

I'm trying to create nginx proxy for demo shell ADF application and calling port 7777 instead of 8080 for authentization. Unfortunately 404 error code is coming back :-( 

Screenshot_3.png

app.config.json

{
  "$schema": "../../lib/core/app-config/schema.json",
  "ecmHost": "{protocol}//{hostname}{:port}",
  "bpmHost": "{protocol}//{hostname}{:port}",
  "identityHost": "{protocol}//{hostname}{:port}/auth/realms/alfresco",
  "loginRoute": "login",
  "providers": "ALL",
  "contextRootBpm": "activiti-app",
  "authType": "BASIC",
  "locale": "en",
  "notificationDefaultDuration": 2000,
  "auth": {
    "withCredentials": false
  },
  "oauth2": {
    "host": "{protocol}//{hostname}{:port}/auth/realms/alfresco",
    "clientId": "alfresco",
    "scope": "openid",
    "secret": "",
    "implicitFlow": true,
    "silentLogin": true,
    "redirectSilentIframeUri": "{protocol}//{hostname}{:port}/assets/silent-refresh.html",
    "redirectUri": "/",
    "redirectUriLogout": "/logout",
    "publicUrls": ["**/preview/s/*", "**/settings"]
  },

nginx.conf

   server {
            listen                          7777;
            server_name                     test.adf.cz;

            #set $allowOriginSite http://127.0.0.1:3000;
            set  $allowOriginSite *;

            gzip                            on;
            gzip_min_length                 1000;
            gzip_proxied                    expired no-cache no-store private auth;
            underscores_in_headers          on;
            proxy_pass_request_headers      on;
            proxy_pass_header  Set-Cookie;

            location /alfresco/ {
                proxy_pass  http://localhost:8080/;
                proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
                proxy_redirect off;
                proxy_buffering off;
                proxy_set_header        Host            $host;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass_header  Set-Cookie;
            }

            location /activiti/ {
                proxy_pass  http://localhost:9999/;
                proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
                proxy_redirect off;
                proxy_buffering off;
                proxy_set_header        Host            $host;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass_header  Set-Cookie;
                proxy_pass_request_headers      on;
            }

            location / {
                proxy_pass  http://localhost:9001/;
                proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
                proxy_redirect off;
                proxy_buffering off;
                proxy_set_header        Host             $host;
                proxy_set_header        X-Real-IP        $remote_addr;
                proxy_set_header        X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header        X-NginX-Proxy    true;
                proxy_pass_header  Set-Cookie;
                proxy_pass_request_headers      on;
            }
    }

Port 8080

Screenshot_4.png
ADF 

Screenshot_5.png

Screenshot_6.png

Do you have any idea how to fix it? I am running everything in docker CE 6.2.



(I'm relatively new to Alfresco, but I'm really wondering if at least one thing will work according to the manual on the first try)
1 Reply
hmirheydari
Active Member

Re: Authentication through nginx proxy returns 404

You must change:

            location /alfresco/ {
                proxy_pass  http://localhost:8080/;

to:

 

            location /alfresco/ {
                proxy_pass  http://localhost:8080/alfresco/;

and other parts(eg 

            location /activiti/ {
                proxy_pass  http://localhost:9999/;

and 

            location / {
                proxy_pass  http://localhost:9001/;

the same way as above.

also you must install Alfresco Identity Service(eg. Keycloak) and configure ACS and APS to work with identity service otherwise you can not use both APS and ACS in your ADF app.