Mixed Content error because of Keycloak default login redirectionwhy is keycloak removing the SSL in the redirect uri?keycloak apache server configuration with 'Mixed Content' problemsHow to avoid login page of KeyCloak and deploy our customized login page of our project?Keycloak CORS issue when being redirected to loginForce Keycloak redirect to user's host address in dockerKeycloak SSO - too many redirectsKeycloak redirects to login on page refreshSpring security application behind zuul proxy ,using keycloak , login is not redirected properlyKeycloak CORS issue associated with login redirectKeycloak Grails Spring - redirection after login

A Rare Riley Riddle

How did Arya survive the stabbing?

Failed to fetch jessie backports repository

How to pronounce the slash sign

Pole-zeros of a real-valued causal FIR system

Valid Badminton Score?

Would a high gravity rocky planet be guaranteed to have an atmosphere?

Was Spock the First Vulcan in Starfleet?

Can the discrete variable be a negative number?

Do sorcerers' Subtle Spells require a skill check to be unseen?

I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?

What is the intuitive meaning of having a linear relationship between the logs of two variables?

How can a function with a hole (removable discontinuity) equal a function with no hole?

What happens if you roll doubles 3 times then land on "Go to jail?"

Is oxalic acid dihydrate considered a primary acid standard in analytical chemistry?

How does buying out courses with grant money work?

Escape a backup date in a file name

India just shot down a satellite from the ground. At what altitude range is the resulting debris field?

Opposite of a diet

Customer Requests (Sometimes) Drive Me Bonkers!

Why are there no referendums in the US?

Is a stroke of luck acceptable after a series of unfavorable events?

Arithmetic mean geometric mean inequality unclear

How does the UK government determine the size of a mandate?



Mixed Content error because of Keycloak default login redirection


why is keycloak removing the SSL in the redirect uri?keycloak apache server configuration with 'Mixed Content' problemsHow to avoid login page of KeyCloak and deploy our customized login page of our project?Keycloak CORS issue when being redirected to loginForce Keycloak redirect to user's host address in dockerKeycloak SSO - too many redirectsKeycloak redirects to login on page refreshSpring security application behind zuul proxy ,using keycloak , login is not redirected properlyKeycloak CORS issue associated with login redirectKeycloak Grails Spring - redirection after login













0















INFORMATION NEEDED:



I use Keycloak (Docker version) behind a Spring project.



(The client side of this project is React and communication between client and backend is provided by REST services.)



The client side is secured and using "https" scheme.



It is my Spring configuration:



 keycloak:
auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
realm: master
resource: clientname
public-client: true


THE ROOT OF THE PROBLEM:



When I click a link from client, it calls a Spring service normally.
But before that, it redirects to default login page of Keycloak with adding this path sso/login to the current "https" url but changing scheme to "http".



But, redirecting from https to http create a problem like this:



Mixed Content: The page at 'https://www.helpful.army/contents/Problem' was loaded over HTTPS, but requested an insecure resource 'http://serviceha-helpfularmy.b9ad.pro-us-east-1.openshiftapps.com/sso/login'. This request has been blocked; the content must be served over HTTPS.









share|improve this question
























  • Do you have reverse proxy on the way to Keycloak? Does it set X-Forwarded-Proto correctly? We've got problem with that, but I can't remember what error did we get then and if your case can be similar...

    – 9ilsdx 9rvj 0lo
    Mar 7 at 16:32











  • I think you have a point. Because, client side is React running on NGINX with a default server config is like this: events worker_connections 1024; http include /etc/nginx/mime.types; server listen 3000; server_name www.helpful.army; root /usr/share/nginx/html; location / try_files $uri /index.html; location ~ .css add_header Content-Type text/css; location ~ .js add_header Content-Type application/x-javascript;

    – Murat Döner
    Mar 7 at 19:21











  • Oke 9ilsdx, I have solved it with your help. Wrote the solution. Thanks.

    – Murat Döner
    Mar 8 at 11:56















0















INFORMATION NEEDED:



I use Keycloak (Docker version) behind a Spring project.



(The client side of this project is React and communication between client and backend is provided by REST services.)



The client side is secured and using "https" scheme.



It is my Spring configuration:



 keycloak:
auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
realm: master
resource: clientname
public-client: true


THE ROOT OF THE PROBLEM:



When I click a link from client, it calls a Spring service normally.
But before that, it redirects to default login page of Keycloak with adding this path sso/login to the current "https" url but changing scheme to "http".



But, redirecting from https to http create a problem like this:



Mixed Content: The page at 'https://www.helpful.army/contents/Problem' was loaded over HTTPS, but requested an insecure resource 'http://serviceha-helpfularmy.b9ad.pro-us-east-1.openshiftapps.com/sso/login'. This request has been blocked; the content must be served over HTTPS.









share|improve this question
























  • Do you have reverse proxy on the way to Keycloak? Does it set X-Forwarded-Proto correctly? We've got problem with that, but I can't remember what error did we get then and if your case can be similar...

    – 9ilsdx 9rvj 0lo
    Mar 7 at 16:32











  • I think you have a point. Because, client side is React running on NGINX with a default server config is like this: events worker_connections 1024; http include /etc/nginx/mime.types; server listen 3000; server_name www.helpful.army; root /usr/share/nginx/html; location / try_files $uri /index.html; location ~ .css add_header Content-Type text/css; location ~ .js add_header Content-Type application/x-javascript;

    – Murat Döner
    Mar 7 at 19:21











  • Oke 9ilsdx, I have solved it with your help. Wrote the solution. Thanks.

    – Murat Döner
    Mar 8 at 11:56













0












0








0








INFORMATION NEEDED:



I use Keycloak (Docker version) behind a Spring project.



(The client side of this project is React and communication between client and backend is provided by REST services.)



The client side is secured and using "https" scheme.



It is my Spring configuration:



 keycloak:
auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
realm: master
resource: clientname
public-client: true


THE ROOT OF THE PROBLEM:



When I click a link from client, it calls a Spring service normally.
But before that, it redirects to default login page of Keycloak with adding this path sso/login to the current "https" url but changing scheme to "http".



But, redirecting from https to http create a problem like this:



Mixed Content: The page at 'https://www.helpful.army/contents/Problem' was loaded over HTTPS, but requested an insecure resource 'http://serviceha-helpfularmy.b9ad.pro-us-east-1.openshiftapps.com/sso/login'. This request has been blocked; the content must be served over HTTPS.









share|improve this question
















INFORMATION NEEDED:



I use Keycloak (Docker version) behind a Spring project.



(The client side of this project is React and communication between client and backend is provided by REST services.)



The client side is secured and using "https" scheme.



It is my Spring configuration:



 keycloak:
auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
realm: master
resource: clientname
public-client: true


THE ROOT OF THE PROBLEM:



When I click a link from client, it calls a Spring service normally.
But before that, it redirects to default login page of Keycloak with adding this path sso/login to the current "https" url but changing scheme to "http".



But, redirecting from https to http create a problem like this:



Mixed Content: The page at 'https://www.helpful.army/contents/Problem' was loaded over HTTPS, but requested an insecure resource 'http://serviceha-helpfularmy.b9ad.pro-us-east-1.openshiftapps.com/sso/login'. This request has been blocked; the content must be served over HTTPS.






spring openshift keycloak






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 15:15







Murat Döner

















asked Mar 7 at 13:10









Murat DönerMurat Döner

163




163












  • Do you have reverse proxy on the way to Keycloak? Does it set X-Forwarded-Proto correctly? We've got problem with that, but I can't remember what error did we get then and if your case can be similar...

    – 9ilsdx 9rvj 0lo
    Mar 7 at 16:32











  • I think you have a point. Because, client side is React running on NGINX with a default server config is like this: events worker_connections 1024; http include /etc/nginx/mime.types; server listen 3000; server_name www.helpful.army; root /usr/share/nginx/html; location / try_files $uri /index.html; location ~ .css add_header Content-Type text/css; location ~ .js add_header Content-Type application/x-javascript;

    – Murat Döner
    Mar 7 at 19:21











  • Oke 9ilsdx, I have solved it with your help. Wrote the solution. Thanks.

    – Murat Döner
    Mar 8 at 11:56

















  • Do you have reverse proxy on the way to Keycloak? Does it set X-Forwarded-Proto correctly? We've got problem with that, but I can't remember what error did we get then and if your case can be similar...

    – 9ilsdx 9rvj 0lo
    Mar 7 at 16:32











  • I think you have a point. Because, client side is React running on NGINX with a default server config is like this: events worker_connections 1024; http include /etc/nginx/mime.types; server listen 3000; server_name www.helpful.army; root /usr/share/nginx/html; location / try_files $uri /index.html; location ~ .css add_header Content-Type text/css; location ~ .js add_header Content-Type application/x-javascript;

    – Murat Döner
    Mar 7 at 19:21











  • Oke 9ilsdx, I have solved it with your help. Wrote the solution. Thanks.

    – Murat Döner
    Mar 8 at 11:56
















Do you have reverse proxy on the way to Keycloak? Does it set X-Forwarded-Proto correctly? We've got problem with that, but I can't remember what error did we get then and if your case can be similar...

– 9ilsdx 9rvj 0lo
Mar 7 at 16:32





Do you have reverse proxy on the way to Keycloak? Does it set X-Forwarded-Proto correctly? We've got problem with that, but I can't remember what error did we get then and if your case can be similar...

– 9ilsdx 9rvj 0lo
Mar 7 at 16:32













I think you have a point. Because, client side is React running on NGINX with a default server config is like this: events worker_connections 1024; http include /etc/nginx/mime.types; server listen 3000; server_name www.helpful.army; root /usr/share/nginx/html; location / try_files $uri /index.html; location ~ .css add_header Content-Type text/css; location ~ .js add_header Content-Type application/x-javascript;

– Murat Döner
Mar 7 at 19:21





I think you have a point. Because, client side is React running on NGINX with a default server config is like this: events worker_connections 1024; http include /etc/nginx/mime.types; server listen 3000; server_name www.helpful.army; root /usr/share/nginx/html; location / try_files $uri /index.html; location ~ .css add_header Content-Type text/css; location ~ .js add_header Content-Type application/x-javascript;

– Murat Döner
Mar 7 at 19:21













Oke 9ilsdx, I have solved it with your help. Wrote the solution. Thanks.

– Murat Döner
Mar 8 at 11:56





Oke 9ilsdx, I have solved it with your help. Wrote the solution. Thanks.

– Murat Döner
Mar 8 at 11:56












1 Answer
1






active

oldest

votes


















0














I have solved this problem and similar ones with these steps:



(1) Frontend side:



You know, www.helpful.army is an educational project which has an interface running on React and it is in NGINX server.
So, I appended the default NGINX server config with mandatory headers:



location / 
try_files $uri /index.html;
proxy_set_header X-Forwarded-Proto $scheme;
**add_header Access-Control-Allow-Origin *;**




(2) Backend side:



I have created a different client on Keycloak just for the Spring-Boot backend and set is as a "Bearer-only" one.



keycloak:
auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
realm: master
resource: serviceha
bearer-only: true
ssl-required: "external"
confidential-port: 0
verify-token-audience: true


I also add this configuration for application.yml:



 server:
port: 8443
remote_ip_header: x-forwarded-for
protocol_header: x-forwarded-proto
use-forward-headers: true


(3) I have changed all ports from interface to backend as 8443






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55044623%2fmixed-content-error-because-of-keycloak-default-login-redirection%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I have solved this problem and similar ones with these steps:



    (1) Frontend side:



    You know, www.helpful.army is an educational project which has an interface running on React and it is in NGINX server.
    So, I appended the default NGINX server config with mandatory headers:



    location / 
    try_files $uri /index.html;
    proxy_set_header X-Forwarded-Proto $scheme;
    **add_header Access-Control-Allow-Origin *;**




    (2) Backend side:



    I have created a different client on Keycloak just for the Spring-Boot backend and set is as a "Bearer-only" one.



    keycloak:
    auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
    realm: master
    resource: serviceha
    bearer-only: true
    ssl-required: "external"
    confidential-port: 0
    verify-token-audience: true


    I also add this configuration for application.yml:



     server:
    port: 8443
    remote_ip_header: x-forwarded-for
    protocol_header: x-forwarded-proto
    use-forward-headers: true


    (3) I have changed all ports from interface to backend as 8443






    share|improve this answer



























      0














      I have solved this problem and similar ones with these steps:



      (1) Frontend side:



      You know, www.helpful.army is an educational project which has an interface running on React and it is in NGINX server.
      So, I appended the default NGINX server config with mandatory headers:



      location / 
      try_files $uri /index.html;
      proxy_set_header X-Forwarded-Proto $scheme;
      **add_header Access-Control-Allow-Origin *;**




      (2) Backend side:



      I have created a different client on Keycloak just for the Spring-Boot backend and set is as a "Bearer-only" one.



      keycloak:
      auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
      realm: master
      resource: serviceha
      bearer-only: true
      ssl-required: "external"
      confidential-port: 0
      verify-token-audience: true


      I also add this configuration for application.yml:



       server:
      port: 8443
      remote_ip_header: x-forwarded-for
      protocol_header: x-forwarded-proto
      use-forward-headers: true


      (3) I have changed all ports from interface to backend as 8443






      share|improve this answer

























        0












        0








        0







        I have solved this problem and similar ones with these steps:



        (1) Frontend side:



        You know, www.helpful.army is an educational project which has an interface running on React and it is in NGINX server.
        So, I appended the default NGINX server config with mandatory headers:



        location / 
        try_files $uri /index.html;
        proxy_set_header X-Forwarded-Proto $scheme;
        **add_header Access-Control-Allow-Origin *;**




        (2) Backend side:



        I have created a different client on Keycloak just for the Spring-Boot backend and set is as a "Bearer-only" one.



        keycloak:
        auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
        realm: master
        resource: serviceha
        bearer-only: true
        ssl-required: "external"
        confidential-port: 0
        verify-token-audience: true


        I also add this configuration for application.yml:



         server:
        port: 8443
        remote_ip_header: x-forwarded-for
        protocol_header: x-forwarded-proto
        use-forward-headers: true


        (3) I have changed all ports from interface to backend as 8443






        share|improve this answer













        I have solved this problem and similar ones with these steps:



        (1) Frontend side:



        You know, www.helpful.army is an educational project which has an interface running on React and it is in NGINX server.
        So, I appended the default NGINX server config with mandatory headers:



        location / 
        try_files $uri /index.html;
        proxy_set_header X-Forwarded-Proto $scheme;
        **add_header Access-Control-Allow-Origin *;**




        (2) Backend side:



        I have created a different client on Keycloak just for the Spring-Boot backend and set is as a "Bearer-only" one.



        keycloak:
        auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
        realm: master
        resource: serviceha
        bearer-only: true
        ssl-required: "external"
        confidential-port: 0
        verify-token-audience: true


        I also add this configuration for application.yml:



         server:
        port: 8443
        remote_ip_header: x-forwarded-for
        protocol_header: x-forwarded-proto
        use-forward-headers: true


        (3) I have changed all ports from interface to backend as 8443







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 8 at 11:35









        Murat DönerMurat Döner

        163




        163





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55044623%2fmixed-content-error-because-of-keycloak-default-login-redirection%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme