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

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

            How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page