[mods.factorio.com] Search doesn't work if not signed in.

A place to talk about the official Factorio mod portal (https://mods.factorio.com)
Post Reply
credomane
Filter Inserter
Filter Inserter
Posts: 278
Joined: Tue Apr 12, 2016 6:21 pm
Contact:

[mods.factorio.com] Search doesn't work if not signed in.

Post by credomane »

If you are not signed into the mod portal then your search query is silently ignored on the backend. Would be nice to either have the search work when not signed in or have an error pop up saying you need to be signed in for it to work. I spent several minutes trying to figure out why it wasn't working before noticing I wasn't signed in. I doubted it was gonna change anything but I signed in anyways and to my surprise search worked after that.


User avatar
vinzenz
Factorio Staff
Factorio Staff
Posts: 174
Joined: Mon Aug 02, 2021 6:45 pm
Contact:

Re: [mods.factorio.com] Search doesn't work if not signed in.

Post by vinzenz »

credomane wrote:
Fri Jan 07, 2022 7:03 pm
If you are not signed into the mod portal then your search query is silently ignored on the backend. Would be nice to either have the search work when not signed in or have an error pop up saying you need to be signed in for it to work. I spent several minutes trying to figure out why it wasn't working before noticing I wasn't signed in. I doubted it was gonna change anything but I signed in anyways and to my surprise search worked after that.
Does it continue to work if you sign out? I added some cleanup for old cookies when you log in on the mod portal. But I haven't got to research how these old cookies prevent searches.
bringing the oops to devops

credomane
Filter Inserter
Filter Inserter
Posts: 278
Joined: Tue Apr 12, 2016 6:21 pm
Contact:

Re: [mods.factorio.com] Search doesn't work if not signed in.

Post by credomane »

I'm terribly sorry. Got busy last week and I forgot to come back to this post.

It is working now when I'm not signed in. I've tried to make it not work again without any success. Assuming whatever cleanup you added did the trick. Or whatever old/bad cookie I had got fixed when I signed back in last week.

credomane
Filter Inserter
Filter Inserter
Posts: 278
Joined: Tue Apr 12, 2016 6:21 pm
Contact:

Re: [mods.factorio.com] Search doesn't work if not signed in.

Post by credomane »

Oh. It is happening again today. I was logged into the mod portal on feb 1st but now today I'm logged out and the search won't function. what info you need from me to look into it? I'll keep the cookies around this time and won't resign in either.


[edit]
Looking at the private window where searching works without logging in and the "public" window where the search broke there is an extra cookie for "mods.factorio.com" for the "public" window. Both windows also have a cookie for "*.factorio.com"

Signing into the private window doesn't create a "mods.factorio.com" cookie.

[edit2]
If I copy the search url https://mods.factorio.com/query/space?version=1.1 from the private window and paste it into the public/broken window the search loads but if I use the search box to search something else I get returned to https://mods.factorio.com/?version=1.1

[edit3]
Looking at the http traffic a search for "space" on the public/broken window sends a post request to https://mods.factorio.com/?version=1.1 which returns a http 200 code.

Doing the same on the private window sends a post request to https://mods.factorio.com/?version=1.1 which returns a http 302 code and redirects to https://mods.factorio.com/query/space?version=1.1


Looks like for some reason the bad cookie is causing the 302 redirect to not happen?

[edit4]
More poking around the tabs "recent/downloaded/trending/popular" are remembered with the broken search and so are the category and version buttons. It just seems like the 302 http redirect just doesn't happen if the bad cookie is present.

Out of curiosity why is the query posted, processed then redirected with a http header and turned into a get request? Why not use a little javascript on the browser side to generate the get result directly?

[edit5]
I've been able to replicate this bug easily now. Just go to http://mods.factorio.com then use your browser's console to delete all the cookies for *.factorio.com and mods.factorio.com
Once that is done try searching and it will fail.

Seems like if whatever cookie is being checked for is either missing or in a bad state (as in previous valid login is now expired) then the search will fail. And in the case of the "bad" cookie it will never get fixed until you sign back in again or manually delete the cookie. If you are logged in and logout then you won't end up in a "bad" cookie state.

Still can't wrap my head around why the way the search is programmed this way and now I'm even more confused on why it relies on a cookie to even function.


[edit6]
Another thing possibly unrelated to the mod portal's login but the CSRF token for the https://factorio.com/login page doesn't always get added/created so I have to sign-in twice since the first time I get a missing CSRF token error.
Image

User avatar
vinzenz
Factorio Staff
Factorio Staff
Posts: 174
Joined: Mon Aug 02, 2021 6:45 pm
Contact:

Re: [mods.factorio.com] Search doesn't work if not signed in.

Post by vinzenz »

thanks for the detailed report!
bringing the oops to devops

Post Reply

Return to “Mod portal Discussion”