Add product to cart works in Firefox but not in Chrome - httprequest

I'm currently developing in Magento 2 and when i add a product to the cart, in Firefox the product is added to the cart and the minicart is updated correctly, yet, in Chrome, this doesn't happen.
Here's what i have gathered from the dev. console of both web browsers:
Firefox:
POST request to /magento/checkout/cart/add/uenc/ramdomString,,/product/idProduct/
This request has a Status code: 200 OK.
GET request to /magento/customer/section/load/?sections=cart,messsages&update_section_id=true&_=someNumber
This request has a Status code: 200 OK.
Chrome:
POST request to /magento/checkout/cart/add/uenc/ramdomString,,/product/idProduct/
This request has a Status code: 302 FOUND.
GET request to /magento/checkout/cart/
This request has a Status code: 200 OK.
GET request to /magento/customer/section/load/?sections=cart%2Cmesssages&update_section_id=true&_=someNumber
This request has a Status code: 200 OK.
As can be seen, the only difference is that Chrome has an additional GET request. I have observed that when this request is made the product is not added to the cart. I have seen this in all my Magento 2 projects (i have several testing projects and in all of them this is happening and some of them are just fresh installations with one category and one product).
Now, i know that if i get Status code: 302 FOUND the resource i've requested has redirected me to somewhere else...but why this doesn't happen in Firefox as well?
I uploaded two images showing more information:
Image 1 corresponds to the first (1.) step -request- in Firefox and Chrome and Image 2 corresponds to the answer of the second step (2.) in Firefox and the third step (3.) in Chrome.
http://imgur.com/eMuiNIr
http://imgur.com/85Vm2PW
I have checked and it doesn't appear to be a cache problem.
Does anyone know what could be the problem?
Thank you.
PS: Neither in Firefox nor in Chrome, updating products within the minicart or within /magento/checkout/cart works as expected.

Related

Testing that page is not 404 page with Cypress and Gatsby

I have a Gatsby site. If I hit a url that doesn't exist, Gatsby serves up a 404 page, however it doesn't change the URL.
I am testing this site using Cypress. Cypress's recommended way of testing navigation within a site is the use of location, however in this instance, checking the pathname of the page that was navigated to is not reliable, as if the page doesn't exist, it will still have the same pathname as if it did. For example if I get Cypress to cy.click() a link with an href of /incorrect-url/, and test its pathname, I would get a passing test, even though the page that loaded was the 404 page, not the page I was expecting.
I know I could test that elements I am expecting are present on the page I've navigated to, but I'd prefer a reliable way to know if the page 404d (Gatsby returns the page with a 404 status code).
To summarise:
checking the Location / pathname is not a reliable way of testing that a specific page has loaded
I don't want to check for elements on the page as a way of verifying
Surely there is way of verifying that the page loaded without a 404 status code.
How can I reliably check that the page navigated to was not the 404 page.
I know the question was asked 2 months ago, so hopefully you've already found a way to validate the status, but as a future reference, you can do a request to your link's href attribute. You will then have access to the status code.
cy.get(SELECTOR FOR YOUR LINK).then((link) => cy.request(link.prop('href')).its('status').should('eq', 200));

Angular 8 load request from Cache in Edge Browsers

I am working in Angular8. I am getting response from various APIs. But some how api request in Edge is not come from server. It was always fetch from cached.
Below is screen shot of dev tool of IE Edge version 44
Same URL works in Chrome & Firefox as expected even in EdgeBeta it works.
Below are few points to note
I am using http_Interceptor to add some customer headers in request(mainly auth Header). that code work as expected. but when request is actually send to server I don't see any headers attached in network tab of dev Tools for Edge browsers
As shown in screen shot, Network tab always show "Received" column value form "Cache" even after I add Expires=-1 and pragma = "no-cache" headers. Theses headers are also not visible in networks tabs. I don't get any error while adding these headers in Interceptor methods.
Even in Edge Dev tool I kept "Always refresh request from Server", edge is not sending request to sever.
Issue is with only IE Edge (Microsoft Edge 44.17763.831.0). Did I miss any poly-fills to support Edge (version 44). chrome and EdgeBeta work as expected.
Any help is appreciated.
Thanks in advances

Rails app can't verify CSRF token on chrome only

I have a Rails app running in a Docker container. I use Devise for authenticating and Rack::Cors for CORS.
On my machine, everything is okay. Once deployed, I can GET the login page correctly, but when I fill in the login form and submit it, Chrome replies with a blank page and a 422 (Unprocessable Entity) status code. The Rails logs reads:
Can't verify CSRF token authenticity.
Completed 422 Unprocessable Entity in 2ms (ActiveRecord: 0.0ms)
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
Interestingly enough, on Firefox, everything runs smoothly.
I've tried everything I could find about Rails, CORS, CSRF, but I wasn't able to find a solution.
I don't really know what kind of information can be relevant here, so feel free to ask for details in the comments, I'll edit the question.
So, I had a similar problem; only I didn't have Devise or Docker. It was a simple form. Your question is missing a lot of contextual information like logs, so I can't tell if you have the same problem, but here's how I fixed mine.
I was getting InvalidAuthenticityToken errors for simple form submissions. Puzzling since it worked fine on Firefox, but would randomly fail on Chrome sometimes, and it always failed on Chrome on Android.
Diagnostics
I took a look at the log and found the following:
Started POST "/invitations" for 172.69.39.15 at 2019-09-26 22:34:26 +0000
Processing by InvitationsController#create as HTML
Parameters: {"authenticity_token"=>"F4ToAfkdPSnJsYewqvxXpsze3XitKHbiGnuEOR+628SdAY5jGRiG15GEuCSSoaVeVdO7eugAnsjKwmZPUpIepg==", "invitation"=>{"name"=>"[FILTERED]", "business"=>"[FILTERED]", "email"=>"[FILTERED]"}, "commit"=>"Apply for invite"}
HTTP Origin header (https://www.example.com) didn't match request.base_url (http://www.example.com)
Completed 422 Unprocessable Entity in 4ms (ActiveRecord: 0.0ms | Allocations: 226)
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
The line that stands out is:
HTTP Origin header (https://www.example.com) didn't match request.base_url (http://www.example.com)
https://www.example.com indeed does not match http://www.example.com, the former has SSL. I was routing my app through Cloudflare, so I had SSL, but my app was expecting a request.base_url without SSL.
Solution
You need to force your app to use SSL. This is what I did to fix this; your exact steps may depend on your architecture. Because I was using Cloudflare, I had to perform these steps in this exact order otherwise, my app could have been knocked offline:
First: I configured SSL on my server. In this case, I was using Heroku, which can use Let's Encrypt to provision SSL automatically.
Second: I configured my app to force SSL by adding the following to production.rb
config.force_ssl = true
Third: Since I no longer needed an HTTP connection between my server and Cloudflare, I switched it to from Flexible to Full.
For what it's worth, I looked back at my code to find how I solved the issue.
I wasn't able to find a clean solution, so I worked around it by disabling the origin check :
# config/initializers/csrf_workaround.rb
Rails.application.config.action_controller.forgery_protection_origin_check = false
Of course, this introduces security vulnerabilities so be sure to post your own answer if you have a cleaner way to get this to work and/or have a real explanation for the question above.
I have same problem when I change from http to https on my gitlab config. As you can see the log below.
Processing by Ldap::OmniauthCallbacksController#ldapmain as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "username"=>"user1", "password"=>"[FILTERED]"}
Can't verify CSRF token authenticity.
Completed 422 Unprocessable Entity in 2ms (ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 308)
Processing by OmniauthCallbacksController#failure as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "username"=>"user1", "password"=>"[FILTERED]"}
Redirected to http://172.20.1.12/users/sign_in
User cannot login with LDAPs account. I found that this problem only in chrome (I try to use firefox and firefox work like charm). After update chrome to new version this problem was gone. So may be the solution is update chrome to the lastest version. I also try lots of solutions that I found on stackoverflow but that not work.

Broken Link Test 404 error, but pages appear in browser

I just did an SEO test of my site http://www.photographyattic.com using seositecheckup.com. It flagged up pages with 404 errors
From 100 distinct anchor links analyzed, 72 of them seems to be broken.
These pages don't seem to be broken when I view with my browser. Example http://www.photographyattic.com/category-1
Any idea why this would be?
http://www.photographyattic.com/category-1 is sending HTTP status code 404. The page doesn’t have to be broken because of that, you can display whatever you like on 404 pages.
You should send the status code 200 instead.

Jmeter error 404

I am trying to load test a webapp, which has following functonality
1. Login in app (setting some cookie variables )
2. Serach customer with some parameter
3. Get detail of particular customer
4. Logout from webapp
When i am running Jmeter i am getting status code 404
Any reference or help will be appriciated.
After googling i found 4** says you have sent bad request.
To check what request has been sent i am using fiddler and capturing original request (which is working from browser ) and request sent by Jmeter , I am comparing data under Inspector tab in Headers in fiddler, Is this right way to resolve the issue of 4**. What else i can do to fix this issue ?
Screen shots attached
I think, the HTTP header manager and HTTP cookie manager must be pushed up just before Recording Controller. Otherwise the requests are made without these header or cookie informations.
If you doing localhost testing should in the cookie manager config domain
localhost:8080.
You can see the request/response in View Results Tree. Just click on the tab Request or Response data respectively. If you're getting a 404, chances are the Response data tab will contain the 404 with (hopefully) information about the values that are invalid or missing.