Forum Stats

  • 3,815,220 Users
  • 2,258,979 Discussions
  • 7,893,004 Comments

Discussions

APEX: Too many redirects

24

Answers

  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,800 Red Diamond

    Can you not after the 2nd tab with error shows, press F12 for DevTools for the 2nd tab, and then press F5 to refresh the the tab? It should use the same 2nd tab URL again, but this time with DevTools enabled.

  • user8952845
    user8952845 Member Posts: 17 Blue Ribbon

    You, sir, seem to know your stuff! Attached is the HAR trace from the second window, and I do see the "Too many redirects" error in there!


  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,800 Red Diamond

    Do not see an obvious error. You can refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie for cookie settings.

    A funny - seems like IPv6 is being used as the Remote Address used by the client to identify itself to the server, is the IPv6 localhost address. Typically IPv4 is used for localhost by default in my experience. But this should not cause an issue.

    The APEX cookie is set without expiry date, which defaults to the browser treating is as a session cookie. It is set as HttpOnly as a security feature, which is correct. SameSite should also beset, but should not cause redirects.

    What seems to happen is that the browser sets the cookie received, and responds to the web server with that cookie. Only for the web server not to accept that cookie, and to issue a new cookie. And for this sequence to repeat and repeat...

    Each request below deals with a brand new session cookie value:

    This likely means that your APEX authentication and authorisation schema is not working - it does not accept a session cookie it just issued.

    What authentication is used by your APEX application, and was this modified?

  • user8952845
    user8952845 Member Posts: 17 Blue Ribbon

    Would the APEX installation log be helpful?


  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,800 Red Diamond

    Would the APEX installation log be helpful?

    Not really - it is not an installation error.

    APEX applications are assigned to an Authorisation Scheme. This authenticates the user, and also authenticates the web session used after successful logon, each time the we browser communicates with the server.

    The web browser supplies the session cookie it has, and the Authentication Scheme verifies this against the web session details it has. This seems to be failing.

    This can be caused by using a modified and buggy Authentication Scheme. It also could potentially be caused by the APEX application.

    How is the new tab opened? What do you click to open the new tab? Why is it opened in a new tab and not the existing tab? The code implemented to do this could be buggy.

  • user8952845
    user8952845 Member Posts: 17 Blue Ribbon
    edited Dec 28, 2020 2:02PM

    As soon as I click run, the new tab opens all by itself. Is that not the expected behaviour? I've tried it with Chrome, Edge, and Opera as the default browser, and the same thing happens. Could ORDS have an issue?

  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,800 Red Diamond

    No. The target attribute of the anchor element needs to be set. But from the sounds of it, you are clicking the APEX IDE button to run an application - which does set the target attribute.

    The APEX IDE is also an APEX application. Seeing that this runs in your case I assume, ORDS is working. ORDS does not know the difference between one or another APEX application.

    I suggest a sanity check. Install a packaged APEX app and see whether it works.

    If not, there is an underlying APEX issue. Though your install.log did not report errors I saw.

    If it does work, then there is a problem with your APEX application definition.

  • user8952845
    user8952845 Member Posts: 17 Blue Ribbon
    edited Dec 28, 2020 10:02PM

    Okay. I installed a sample app (Calendar), and when I try to run it, I get a login screen. I enter the credentials and get "Your session has ended. Click here to create a new session." I click there, and it asks for credentials again, and we just keep looping around getting the "Your session has ended..." and entering the credentials again forever.

    I did make some progress though. When I get the too many redirects error on my own little app, if I copy the URL from the address bar and paste it into a different browser, the app runs!

    I'm curious about the self-signed certificate. Kaspersky complains about it each time I start apex. I tell it to continue anyway, and can run Apex. I'm wondering if that's creating problems down the road when I try to run an app? I put an exemption for localhost into Kaspersky, but then the browser itself complains. If I pause Kaspersky, the same thing happens. If I tell the browser to continue anyway, I get the same too many redirect errors.

  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,800 Red Diamond

    A self-signed certificate should not cause redirects. As it is not signed by recognised RA or CA, the self-signed certificate will not be accepted by default. The browser then needs to be forced to accept the certificate.

    Not familiar with Kaspersky - do not use Windows on my side. Make very sure though that Kaspersky does not cause the error. It is the only foreign actor in this APEX config you have mentioned thus far, and could be root cause.

    What happens when you directly try the base URL for your app without using the run button? E.g. https://localhost:8443/ords/f?p=TEST

    I assume your app's APEX alias is TEST - if not, use the app ID (e.g. 100) instead of TEST in the URL.

    This URL should result in your APEX app's login page to be displayed, with an APEX session created on the database side, and a session cookie to have been accepted by the browser. You should be able to successfully logon to your test app.

    Try this directly after loading the browser - prior to using other APEX URLs, or opening other tabs.

    If it works, open a second tab and run the APEX IDE and sign into the workspace - then test the app in the first tab to determine if it still works.

  • user8952845
    user8952845 Member Posts: 17 Blue Ribbon

    Using  https://localhost:8443/ords/f?p=TEST works fine.

    When I open a second tab and go to the IDE url, I immediately get ERR_TOO MANY_REDIRECTS in that second tab. The first tab continues to work properly. The HAR trace of the second tab is attached.