Redirect After Voting

2 years 6 months ago #283
Topic Author
chesfam's Avatar
Posts: 11
Redirect After Voting

Hello:

I am using the component on a dev site here ( www.chesapeakemothers.com/kids-of-summer-2016 ) After someone votes, they try to go back the home page and get the following error message: "The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies."

I asked my programmer to look into it and he responded below: "It appears that norrcompetitions is the culprit for the redirect error.. I had that happen just now.. after clearing cookies.. making a vote then reloading the page, it directed to the home page.. which redirected over and over to the home page.. after clearing cookies again.. it loads the page fine.. but going back to the competions page to view the gallery again.. just keeps redirecting to the home page..

If we disable the plugin, the site works normally. Any ideas what the settings should be? We only want people to be able to vote once per photo contest. Please advise. Thank you.

2 years 6 months ago #284
Dmitry's Avatar
Posts: 661
Re: Redirect After Voting

Hello!

I am confused, because I just checked our demo website , my development website and website on my localhost and I cannot reproduce the problem.

I also not sure how does voting can force a redirect, it is simple ajax call it and it does not store any redirect cookies or something...

Dmitry


Like our extensions and support?
Add your voice to the JED listing with a 100-score review: bit.ly/2ciJBqC
Thanks!

2 years 6 months ago #285
Topic Author
chesfam's Avatar
Posts: 11
Re: Redirect After Voting

It happens once the vote has been accepted. It thanks you for the vote and then you click on the Home link and the site gives the error message. Were you able to recreate it on the URL of my demo site?

Note that this also happens in the backend when we are working on the NorrCompetitions settings. Doesn't resolve until I restart my browser. This also happens in Safari but it gives a different redirect explanation.

2 years 6 months ago #286
Dmitry's Avatar
Posts: 661
Re: Redirect After Voting

Were you able to recreate it on the URL of my demo site?

Yes I did. But did you recreate it on our demo website?

Note that this also happens in the backend when we are working on the NorrCompetitions settings.

This is really odd. We have many users of NC and no reports about such redirect. I am working in backend during development and testing very often and does not have this redirect bug. I can't imagine what code in our component can cause this redirect.

Dmitry


Like our extensions and support?
Add your voice to the JED listing with a 100-score review: bit.ly/2ciJBqC
Thanks!

2 years 6 months ago #287
Topic Author
chesfam's Avatar
Posts: 11
Re: Redirect After Voting

Hi Dmitry,

This is Heath.

The redirect is absolutely happening only when norr competion.. is enabled.

I'm not interested in the NorrNext demo site for the extension as that appears to be working properly, and as it does not show super admin features of the component, nor full menus for such to compare configurations. Nor am I interested in your test results on the NorrNext demo site as that does not help to make it work on the site in question,

configuration information was not even asked for to compare as a test..

not to sound bad or mean in any way.. but simply to the point and to be blunt.. I'm obviously interested in getting the component that was purchased to work properly for the chesapeakefamily.com website. We are testing it on a development site chesapeakemothers.com before installing it on the main website, as is customary to test any new extension before placing it on the main website to insure that it works properly.

The issue is something happening with norr competition, and is related to cookies, as described..

If the component and it's plugins are disabled.. there is no issue with the joomla functionality.. if the component and main plugin is enabled and as Heather described, if a vote is made, the ajax works for taking the vote and giving a thank you.. at that point it appears that a cookie is modified. I can probably show an example if you need it of the cookie differences.

After a vote is made.. when going to another page or the same page (refresh) on the website, that is where the redirect-loop occurs redirecting first to the home page, then over and over to the home page again until the browser throws an error. that continues until either the norr component and plugins are disabled, or cookies are cleared from the browser. disabling the plugin does not make a difference, but disabling the component does.. that is the testing so far on narrowing the issue to the competition extensions.

if the page is simply refreshed after voting.. the browser is redirected to the home page, and experiences the redirect loop. if the menu link for the competition is clicked after voting, it redirects to the home page.. NONE of this occurs until after a vote is made on a competition.

I've tested this with meta-refresh disabled in the browser, so it is not html or javascript meta-refresh.. it is related to something else, if that helps to narrow down the issue.. I've tried to review the code to find where this is happening and I've narrowed it down that it is not related to the plugin, but is related to the component.

if you can help to narrow the cause of the issue further, that might help. but mentioning that you do not have an issue on your demo site is not great support, or of much help.

it would be appreciated if this can be made to work properly first on chesapeakemothers.com and then on the main website of chesapeakefamily.com.

Thanks,

Regards,

Heath

2 years 6 months ago #288
Dmitry's Avatar
Posts: 661
Re: Redirect After Voting

Hi Heath.

Thank you for your advanced explanation.

Yes I clearly understand that this is something cookie related, but component is setting a standard one with no redirects. After playing around with it I found out that the cause is the content of the cookie.

For example, after voting the cookie value is set to %7B%221%22%3A%5B%222016-03-30+06%3A31%3A26%22%5D%7D, it's URL encoded JSON string {"1":["2016-03-30 06:31:26"]}. So I tried to modify the value in different ways and found the problem with these sequence of symbols:
%22%7B - decoded value is "{
%27%7B - decoded value is '{
%5B%22 - decoded value is ["
%5B%27 - decoded value is .

Moreover when I set the content of any cookie (not only of our component) on your website to value that contains the above mentioned sequence it causes the redirect and strange response from your server.

Why? I do not know. May be you have some security plugins in Joomla or some kind of protection enabled on your server?

Dmitry


Like our extensions and support?
Add your voice to the JED listing with a 100-score review: bit.ly/2ciJBqC
Thanks!

2 years 6 months ago #289
Topic Author
chesfam's Avatar
Posts: 11
Re: Redirect After Voting

Hi Dmitry,

Thank you for your explanation on the specific cookie value, and you are right about that.

However, in regards to your question about security extensions, I have tested by disabling security features on the test website that might intercept the cookie data described for the specific symbols mentioned and act upon them to possibly be causing the redirect and it did not make a difference.. I also tested by completly disabling security and whitelisting my ip just in case, and the redirect to the home page was still present, though without a redirect loop error.

I've just redownloaded the components and modules to insure that the latest versions are used, as I was not the person who downloaded or installed the competition extensions at first. I plan to test these on a clean joomla install without any other third party extensions running, and see if I can replicate the error.

Since the redirect is still present when disabling the joomla firewalls. I would ask if you have tested the competition extensions on a server that has Mod_Security enabled? though I don't see an error logged yet regarding that, it comes to mind, as it might have an issue with the url encoded values as they are. I also plan to check to see if perhaps there is some conflict with some other third party extension on the site.

I think it might however be much easier, and save a lot more time to possibly modify the extension's cookie handling feature, where the data for the vote date value could be rewritten or encoded in a different way to write to the cookie, that does not help cause the redirect.. then for the cookie reading portion of the code, to also be modified to decode or somehow use the different type of value, that does not interfere with the rest of the working site, or the functionality of the norr-competion extensions.

For instance that value of %7B%221%22%3A%5B%222016-03-30+06%3A31%3A26%22%5D%7D
could be base64 encoded to JTdCJTIyMSUyMiUzQSU1QiUyMjIwMTYtMDMtMzArMDYlM0EzMSUzQTI2JTIyJTVEJTdE before writing the cookie.

Then when the component reads that cookie value of JTdCJTIyMSUyMiUzQSU1QiUyMjIwMTYtMDMtMzArMDYlM0EzMSUzQTI2JTIyJTVEJTdE, to simply have a decode function placed before the rest of the cookie value handling code that would then use the decoded value of %7B%221%22%3A%5B%222016-03-30+06%3A31%3A26%22%5D%7D as normal.

If you could give me an idea of where in the php code to begin to look for the cookie handling features, it would be very helpful. or if you would find it much easier to make such a change to the code yourself, and provide it as either a custom solution or possibly integrate it into the product for future updates.. it might prevent such a situation from happening again. either way could be very helpful.

Your further input appreciated.

I hope that a simple solution can be made that will get this working before the competition start date.

Thanks,

Regards,

Heath

2 years 6 months ago #290
Dmitry's Avatar
Posts: 661
Re: Redirect After Voting

Yes, base64 is the key to solve the issue :)
Please find the patched file in the attachment. First backup /components/com_competition/models/participant.php file and then overwrite it with the attached one.

Let me know if you need anything else.

Dmitry


Like our extensions and support?
Add your voice to the JED listing with a 100-score review: bit.ly/2ciJBqC
Thanks!

2 years 6 months ago #291
Topic Author
chesfam's Avatar
Posts: 11
Re: Redirect After Voting

Hi Dimitry,

Thank you so much..

Before I read your reply, I had found the participant.php file and was working on that, with a little confusion about how to go about changing it to work right. I had been reading about a possible issue with different php versions where base64_decode might have issue with interpretation of spaces and + characters. And trying to decide the order of the code change to test.. And trying to learn a little about the code of the extension and the json encoding and decoding of the nc_vote_# variable and its json encoded value. Confusing for me as I was unfamiliar with using json encoded values in cookies..

I had also been monitoring the forum hoping for a soon reply, hoping it was within at least a few days.

Then I saw your reply with the patch file, made so soon. :)

You saved me a possible headache with your very fast reply and working solution.

It works great! and so far no issues with the php version. :)

Excellent support.

I think Heather will be very happy that this is working now, and working well with security, without flaw.

thank you so much.

Regards,

Heath

2 years 6 months ago #292
Dmitry's Avatar
Posts: 661
Re: Redirect After Voting

Heath,

I am glad that it worked ;) AFAIK there should not be an issue with whitespace and + character.
Please resolve this issue by clicking on "Accept As Answer" on some of my posts :)

Dmitry


Like our extensions and support?
Add your voice to the JED listing with a 100-score review: bit.ly/2ciJBqC
Thanks!

You can get our help: Monday - Friday / 09:00 to 17:00 (GMT+2). but not limited. Our staff will be pleased to provide Premium support to every paid subscriber asap, but sometimes you should be ready to wait for our reply for up to 3 days. In case of free extensions we do the best to develop and maintain them either, but their support is not necessary.

Product Latest Update