How can I set _prodigy_ cookie's domain separate from host bind address?

I am attempting to run prodigy behind a reverse proxy. Unfortunately, the _prodigy_ cookie's domain is set by the host/PRODIGY_HOST configuration values.

When visiting a prodigy page, the browser console logs: Cookie "_prodigy_" has been rejected for invalid domain.

You can recreate the cookie issue by launching prodigy locally with PRODIGY_HOST=0.0.0.0 and visiting http://localhost:8080.

I want prodigy to listen on 0.0.0.0 but set the cookie's domain to x.y.z for example. How can I best accomplish this goal?

Hi Jon.

Do you see an error in the console or does the app not load?

You may find this commend insightful in the meantime:

Vincent,

Thanks for the reply and apologies for my tardy follow-up. Unfortunately, I did not get a notification.

The error occurs in the browser console logs. Due to the prodigy server configuration limitation, the cookie is not stored in the browser and re-sent back to the server in a subsequent response.

Maybe the _prodigy_ cookie is not used by the prodigy server.

Let's go over a few checks then.

Could you confirm the Prodigy/Python version just to ensure that you're running a modern version?

Could you confirm that this issue persists across browsers? I'm aware of a few mishaps on the Brave browser.

Is there anything noteworthy when you look at the verbose Prodigy logs? You can view the logs via;

PRODIGY_LOGGING=verbose prodigy ... 

Vincent,

Again, thanks for the reply and apologies for my tardy follow-up.

"Prodigy/Python version?": v3.10 and v1.11.7

"Could you confirm that this issue persists across browsers?" Yes. I tested with latest Chrome, Firefox and Safari.

"Is there anything noteworthy when you look at the verbose Prodigy logs?" Unfortunately, there is no noteworthy information from the server. The browsers are rejecting the cookie because the cookies' domain (0.0.0.0) does not match localhost.

I just tried running this locally on my server:

PRODIGY_HOST=0.0.0.0 python -m prodigy checkbox -F recipe.py

I am able to:

  • open up http://localhost:8080 locally
  • open up http://0.0.0.0:8080 locally
  • have VSCode ssh into the same machine and forward everything properly on my laptop

This is making me wonder if this is perhaps a firewall setting on your end. So just to check, are you able to run webservers just fine? Can you visit the fileserver via the browser when you run this in a folder with files:

python3 -m http.server

Vincent,

Thanks for sticking with my question, BTW.

I can browse also. If you check your browser's console log, you will see that the _prodigy_ cookie is rejected as the cookie's domain, 0.0.0.0, does not match the URL's host (e.g., localhost).

Either:
a) The cookie is not required and all is well, or
b) Due to the cookie being required, we are not able to deploy prodigy behind a proxy (e.g., some.internal.domain) and have prodigy listen a containerized interface (e.g., 0.0.0.0).

When I run it, I do not see a cookie rejection notice.

Just to check one more thing, are you running any browser extensions that might influence this?

Also, besides this warning in the console, are you noticing any other issues?

Vincent,

No browser extensions are loaded. The error is logged in both desktop Firefox and Safari consoles. Your screenshot looks like you are using Chrome. I did not test Chrome.

Other than the console warning, I am not sure what the cookie's purpose is. Prodigy is not always reliable (e.g., duplicate annotations in output). I thought the cookie issue might reduce reliability as it was the only logged error I could find in either server or browser session.

If it helps, my local prodigy setup is a docker image running prodigy that I attempt to access locally using port forwarding.

Could you share the Dockerfile that Prodigy is running in? It's much easier to figure out a solution if I can reproduce the error locally.

Vincent,

Here is the contents of the Dockerfile:

FROM python:3.10-slim

COPY prodigy-*-cp310-cp310-linux_x86_64.whl /tmp/
RUN python -m pip install --no-cache prodigy -f /tmp/ && \
    rm /tmp/prodigy-*-cp310-cp310-linux_x86_64.whl && \
    python -m pip install --no-cache psycopg2-binary && \
    groupadd prodigy && \
    useradd -m -g prodigy prodigy
USER prodigy
WORKDIR /home/prodigy

COPY training_data/* /home/prodigy/

I just tried running it locally and it all seems to work.

I start up the Docker container via:

docker build -t prodiggity .
docker run -it -p 8888:8888 --entrypoint bash prodiggity

And then have it run:

python -m prodigy textcat.manual dataset examples.jsonl --label a,b

With the following prodigy.json:

{
    "port": 8888,
    "host": "0.0.0.0"
}

I'm unable to reproduce the warnings that you're seeing. So as long as the cookie warnings can be ignored, I would do that because they seem like they might be related to something that I cannot produce locally.

If it is a breaking issue, we could dive in further, but we'd need to think about how we might be able to get the error reproduced. Have you checked if this error persists on your colleague's machines or when you are on another network?

This is not a breaking issue. I was trying to fix the browser cookie error with a configuration option IFF the _prodigy_ cookie was necessary. Sounds like the _prodigy_ cookie is not necessary.

1 Like