Error 504/404 when sign in to nginx app with twitter using keycloak

29 views Asked by At

i have problem with login via twitter using keycloak when i click twitter button login

i get 504/404 error:

GET https://******.com/realms/fm-users/broker/twitter/504 404 (Not Found)

network errors

created twitter identity provider in keycloak

twitter identity provider:

setup auth 2.0 in twitter developer

configuration:

got here id and secret

keys

i have nginx conf:

server {
 listen 80;
 server_name frontend;

 access_log  /var/log/nginx/access.log;
 error_log   /var/log/nginx/error.log;

 location /manifest.json {
    root   /usr/share/nginx/html;
    index  index.html;
    try_files $uri $uri/ /manifest.json;
 }

 location / {
    root   /usr/share/nginx/html;
    index  index.html;
    try_files $uri $uri/ /index.html;
    auth_basic "Restricted Content";
    auth_basic_user_file /etc/nginx/.htpasswd;
 }

 #--------keycloak---------

 location /realms/fm-users/ {
    proxy_read_timeout 90;
    proxy_pass http://fm-keycloak:8080;
    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-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Scheme $scheme;

    client_max_body_size 30m;
 }

 location /resources/ {
    proxy_read_timeout 90;
    proxy_pass http://fm-keycloak:8080;
    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-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Scheme $scheme;

    client_max_body_size 30m;
 }

 #--------fm-ms-image-provider---------

 location ~\/api\/save-image(.*)$ {
       proxy_pass http://app-fm-image-provider-users:9205;
       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-Forwarded-Host $host;
       proxy_set_header X-Forwarded-Server $host;
       proxy_set_header X-Forwarded-Proto $scheme;
 }

 location ~\/api\/remove-image\/(.*)$ {
       proxy_pass http://app-fm-image-provider-users:9205;
       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-Forwarded-Host $host;
       proxy_set_header X-Forwarded-Server $host;
       proxy_set_header X-Forwarded-Proto $scheme;
 }

 location ~\/public\/api\/image(.*)$ {
       proxy_pass http://app-fm-image-provider-users:9205;
       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-Forwarded-Host $host;
       proxy_set_header X-Forwarded-Server $host;
       proxy_set_header X-Forwarded-Proto $scheme;
 }

 #--------fm-ms-system---------

 location ~\/public\/api\/module-types\/program\/(.*)$ {
          proxy_pass http://app-fm-system:9202;
          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-Forwarded-Host $host;
          proxy_set_header X-Forwarded-Server $host;
          proxy_set_header X-Forwarded-Proto $scheme;
 }


 #--------fm-ms-users---------

  location ~\/api\/user\/(.*)$ {
         proxy_pass http://app-fm-users:9203;
         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-Forwarded-Host $host;
         proxy_set_header X-Forwarded-Server $host;
         proxy_set_header X-Forwarded-Proto $scheme;
  }

  location ~\/public\/api\/(.*)$ {
           proxy_pass http://app-fm-users:9203;
           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-Forwarded-Host $host;
           proxy_set_header X-Forwarded-Server $host;
           proxy_set_header X-Forwarded-Proto $scheme;
  }

  location ~\/api\/(.*)$ {
       proxy_pass http://app-fm-users:9203;
       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-Forwarded-Host $host;
       proxy_set_header X-Forwarded-Server $host;
       proxy_set_header X-Forwarded-Proto $scheme;
  }

}

and another "load balancer" nginx above:

server {
        listen 80;
        listen [::]:80;
        server_name ****.com;
        return 301 https://****.com;

        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;
        client_max_body_size 4M;
}

server {
  listen 443 ssl;
  server_name ****.com;

  proxy_buffer_size 128k;
  proxy_buffers 4 256k;
  proxy_busy_buffers_size 256k;
  client_max_body_size 30m;

  ssl_certificate /etc/nginx/certificate/fm/users/nginx-certificate.crt;
  ssl_certificate_key /etc/nginx/certificate/fm/users/nginx.key;

  #--------keycloak---------

     location /realms/fm-users/ {
        include /etc/nginx/includes/proxy.conf;
        proxy_read_timeout 90;
        proxy_pass http://fm-keycloak:8080;

        client_max_body_size 30m;
     }

     location /resources/ {
        include /etc/nginx/includes/proxy.conf;
        proxy_read_timeout 90;
        proxy_pass http://fm-keycloak:8080;

        client_max_body_size 30m;
     }

  access_log /var/log/nginx/logs-fm.log main;
  error_log  /var/log/nginx/error-fm.log error;


  location / {
      include /etc/nginx/includes/proxy.conf;
      proxy_pass http://app-fm-tower;
    }
}

maybe i need add some endpoint to nginc.conf?

1

There are 1 answers

0
user22958704 On

problem was i used oauth 2.0 id and secret before but only consumer id and secret is working