Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect redirect to malformed url within AUT - adding _/ in url #3975

Closed
hhudson opened this issue Apr 16, 2019 · 53 comments · Fixed by #5273 or #15995
Closed

Incorrect redirect to malformed url within AUT - adding _/ in url #3975

hhudson opened this issue Apr 16, 2019 · 53 comments · Fixed by #5273 or #15995

Comments

@hhudson
Copy link
Contributor

hhudson commented Apr 16, 2019

Current behavior:

When I instruct cypress to login to an Oracle APEX application, the authentication re-directs cypress to a '404 not found' page because the authenticated URL is malformed. The malformed URL is the only issue and can simply corrected programmatically (with a find and replace command).
Screen Shot 2019-04-15 at 10 14 48 PM

However - it is very important to note that the cypress login correctly returns:

  1. a valid cookie
  2. a valid session

which is everything you need for authentication.

Desired behavior:

Cypress, ideally, should be able to follow the same authentication redirect that a user would in a regular browser.

Steps to reproduce: (app code and test code)

I created a dummy application with dummy credentials hosted by apex.oracle.com to demonstrate:

it('Login demo', function() {
    cy.visit('https://apex.oracle.com/pls/apex/f?p=54707:LOGIN_DESKTOP')
    cy.get('#P9999_USERNAME').type('ApexUser')
    cy.get('#P9999_PASSWORD').type('Oradoc_db1')
    cy.get('.t-Button').click()
  })

The above code (which should work until the application expires in many months) will redirect to a 404 not found page with a url in the format:
https://apex.oracle.com/__/f?p=54707:1:[session_id]:::::
Outside of cypress the url will have the format:
https://apex.oracle.com/pls/apex/f?p=54707:1:[session_id]:::::

Versions

I have tested this across 4 instances of Oracle APEX (APEX 5.0, 5.1, 18.1 and 19) and this behavior is consistent.

@cypress-bot cypress-bot bot added the stage: needs investigating Someone from Cypress needs to look at this label Apr 18, 2019
@MaikMichel
Copy link

I face the same problem. But only when using chromium. If I use elektron, it works.

@hhudson
Copy link
Contributor Author

hhudson commented Apr 30, 2019

I face the same problem. But only when using chromium. If I use elektron, it works.

That is very good to know. Just teste on Electron 59 to confirm that this works for my case as well. Thank you, @MaikMichel

@jennifer-shehane
Copy link
Member

Another issue where 404 is returned due to malformed url containing /_/ #4472

@jennifer-shehane
Copy link
Member

I can recreate this issue from the original code provided in the main comment. This is still happening in 3.3.2 pre-release version.

@flotwig flotwig self-assigned this Jun 24, 2019
@cypress-bot cypress-bot bot added stage: investigating Someone from Cypress is looking into this and removed stage: needs investigating Someone from Cypress needs to look at this labels Jun 25, 2019
@jennifer-shehane
Copy link
Member

Since this issue only exhibits itself within Chrome - we figure it is a change in Chrome that caused this issue to happen in Cypress. I also assume it is not a bug, as the issue still persists in version 77. It may be an intended change in behavior.

Narrowing down the version of Chrome that it was introduced, it was introduce in version 71.0.3572.0, specifically between commits 7e3da6dc3d7cd7eb8a55ef301026fe1ab737f814 and 56dd83c9005f68d55ddbf85c551759526b4e37cd:

  • Chrome 61.0.3163.100 - PASSES
  • Chrome 69.0.3452.0 - PASSES
  • Chrome 71.0.3572.0 - PASSES = Base = 597039 7e3da6dc3d7cd7eb8a55ef301026fe1ab737f814
  • Chrome 71.0.3572.0 - FAILS = Base = 597057 56dd83c9005f68d55ddbf85c551759526b4e37cd
  • Chrome 72.0.3583.0 - FAILS
  • Chrome 73.0.3683.0 - FAILS
  • Chrome 74.0.3729.0 - FAILS
  • Chrome 77.0.3833.0 - FAILS

⭐️ Changelog where issue was introduced

@flotwig good luck 😅

@jennifer-shehane jennifer-shehane changed the title Incorrect redirect during Oracle APEX login Incorrect redirect to malformed url within AUT - adding _/ in url Jun 25, 2019
flotwig added a commit that referenced this issue Jun 26, 2019
@cypress-bot cypress-bot bot added stage: work in progress There is an open PR for this issue [WIP] and removed stage: investigating Someone from Cypress is looking into this labels Jun 26, 2019
@hhudson
Copy link
Contributor Author

hhudson commented Oct 10, 2019

Wanted to check back in and confirm that the issue has been resolved in the Chrome 77 browser. Thanks!

@hhudson hhudson closed this as completed Oct 10, 2019
@drumbeg
Copy link

drumbeg commented Oct 24, 2019

Issue now present in Cypress 3.5.0 when using Electron.

@drumbeg
Copy link

drumbeg commented Oct 24, 2019

Please re-open this issue. It is apparent in Electron 73 that ships with Cypress 3.5.0.

@flotwig
Copy link
Contributor

flotwig commented Oct 24, 2019

Re-opening since others are still running in to this: #5442

@hhudson
Copy link
Contributor Author

hhudson commented Nov 1, 2019

With the new 3.6.0 update, the problem has both regressed and gotten worse, unfortunately. This behavior manifests in both the electron and chrome browsers (when I 1st opened this issue, the issue was restricted to the chrome browser)

@drumbeg
Copy link

drumbeg commented Nov 8, 2019

With the new 3.6.0 update, the problem has both regressed and gotten worse, unfortunately. This behavior manifests in both the electron and chrome browsers (when I 1st opened this issue, the issue was restricted to the chrome browser)

Hayden, do you have a workaround for the issue? I noticed you mentioned programatically replacing part of the url. I'm trying to get this to work, but no luck yet.

@hhudson
Copy link
Contributor Author

hhudson commented Nov 10, 2019

With the new 3.6.0 update, the problem has both regressed and gotten worse, unfortunately. This behavior manifests in both the electron and chrome browsers (when I 1st opened this issue, the issue was restricted to the chrome browser)

Hayden, do you have a workaround for the issue? I noticed you mentioned programatically replacing part of the url. I'm trying to get this to work, but no luck yet.

David - currently my workaround is to use Cypress version 3.4.1, which does not have this issue.

Were I to upgrade, I think I could still live with it because Cypress is technically logging in successfully, i.e. the session id is valid. Therefore, if my purpose is simply to reach pages other than the login page, I can construct a valid url using the session id (and setting the cookie, of course).

@drumbeg
Copy link

drumbeg commented Nov 11, 2019

With the new 3.6.0 update, the problem has both regressed and gotten worse, unfortunately. This behavior manifests in both the electron and chrome browsers (when I 1st opened this issue, the issue was restricted to the chrome browser)

Hayden, do you have a workaround for the issue? I noticed you mentioned programatically replacing part of the url. I'm trying to get this to work, but no luck yet.

David - currently my workaround is to use Cypress version 3.4.1, which does not have this issue.

Were I to upgrade, I think I could still live with it because Cypress is technically logging in successfully, i.e. the session id is valid. Therefore, if my purpose is simply to reach pages other than the login page, I can construct a valid url using the session id (and setting the cookie, of course).

How would you do this? Do you have an example? I have tried logging in and then replacing the page name in the url whilst keeping the session section whilst also preserving the cookie. I still can't get around the issue though, so if you have a working workaround I would love for you to share it.

@drumbeg
Copy link

drumbeg commented Nov 11, 2019

Tested on 3.6.1. Bug is still apparent.

Was expecting 3.6.1 to contain a resolution for this, but maybe confusing issues.

Our 50 developers are keen to see a fix!

@jennifer-shehane
Copy link
Member

If you're experiencing this bug still, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

@Yann39
Copy link

Yann39 commented Sep 2, 2020

I am also facing this issue with all browsers including Electron :

  • Electron
  • Edge 85 (85.0.564.41)
  • Chrome 85 (85.0.4183.83)
  • Firefox 80 (beta)

Cypress 4.7.0
Node v8.11.3

Same after upgrading to latest versions:
Cypress 5.1.0
Node v12.18.3

it('Login page', () => {

        // visit main home page
        cy.visit('https://tstapex.myhost.ch/ords/f?p=119')

        // make sure we are redirected to login
        cy.url().should('include', 'LOGIN_DESKTOP')

        // log in
        cy.get('#P9999_USERNAME').type('username')
        cy.get('#P9999_PASSWORD').type('password')

        // click login button
        cy.get('#login-button').click();

    })

I'm redirected to https://tstapex.myhost.ch/__/f?p=119:1:28275213605974:::::

Then of course get:

Not Found
The requested URL /__/f was not found on this server.

Setting experimentalSourceRewriting to true does not help.

@gcoombe
Copy link

gcoombe commented Nov 16, 2020

Are there any other workarounds? We can't use the experimental flag since apparently it breaks with react-router #7906 . Currently Cypress just breaks for us on a number of pages.

@intoeetive
Copy link

Not really a solution, but following approach worked for me:

cy.wait(20000);
cy.visit(my_url);

tgriesser added a commit that referenced this issue Apr 14, 2021
tgriesser added a commit that referenced this issue Apr 14, 2021
tgriesser added a commit that referenced this issue Apr 14, 2021
tgriesser added a commit that referenced this issue Apr 14, 2021
@bahmutov bahmutov reopened this Apr 15, 2021
@cypress-bot cypress-bot bot added the stage: work in progress There is an open PR for this issue [WIP] label Apr 15, 2021
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress There is an open PR for this issue [WIP] and removed stage: work in progress There is an open PR for this issue [WIP] stage: needs review The PR code is done & tested, needs review labels Apr 26, 2021
@cypress-bot cypress-bot bot added stage: work in progress There is an open PR for this issue [WIP] stage: waiting and removed stage: needs review The PR code is done & tested, needs review stage: work in progress There is an open PR for this issue [WIP] labels May 5, 2021
@flotwig flotwig removed their assignment May 5, 2021
@cypress-bot cypress-bot bot added stage: pending release There is a closed PR for this issue and removed stage: waiting labels May 7, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 7, 2021

The code for this is done in cypress-io/cypress#15995, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@jennifer-shehane
Copy link
Member

If you'd like to try the fix from the #15995 PR before the release, you can follow these instructions to download a pre-release version of Cypress.

@jennifer-shehane
Copy link
Member

Released in 7.3.0.

This comment thread will been locked. If you are still experiencing this issue after upgrading to Cypress v7.3.0, please open a new issue.

@jennifer-shehane jennifer-shehane removed the stage: pending release There is a closed PR for this issue label May 11, 2021
@cypress-io cypress-io locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.