That port 5000 is mentioned makes it look like the HTML code of the page 
requesting the image is hardwiring port 5000. Apache/mod_wsgi shouldn't be 
generating that since it isn't set up to use that port. That or the Flask 
config mentions port 5000 somewhere and that is used in generating URLs.

That said, if a proxy is used in front of Apache/mod_wsgi, it may be worthwhile 
reading:

* http://blog.dscpl.com.au/2015/06/proxying-to-python-web-application.html
* http://blog.dscpl.com.au/2015/07/redirection-problems-when-proxying-to.html

These talks about how to configure mod_wsgi and set up your app so that public 
host and port are properly passed through to mod_wsgi backend and then used by 
your application when generating URLs.

Anyway, see if that gives you any ideas. Grep through your code and see if 5000 
is mentioned anywhere.

Graham

> On 15 May 2023, at 7:57 pm, Babacar Sow <[email protected]> wrote:
> 
> Hi,
> i wrote a website via flask however i am facing a problem. I have a virtual 
> machine that performs a haproxy that redirects givemeasign requests to this 
> virtual machine.
> The flask website is used as a backend for a chrome extension which is 
> supposed to display gifs on a webpage. However, since the website is launched 
> in http mode, I have an error when my extension fetch 
> http://givemeasign.unamurcs.be because the site is in http. if I want to 
> display a gif on an https page then I get an error like this.(see picture)
> <Capture d’écran 2023-05-15 115247.png>
> For the ha proxy to be done I use docker. Here is the docker file I'm using.
> 
>   # Utilisez une image Python pré-configurée
> FROM python:3.9
> 
> # Installez les dépendances
> COPY requirements.txt /app/requirements.txt
> WORKDIR /app
> # update packages
> RUN apt-get -qq update
> RUN apt-get install --yes apache2 apache2-dev
> RUN pip install mod_wsgiA
> RUN python -m pip install --upgrade pip
> RUN pip install --no-cache-dir -r requirements.txt
> 
> # Copiez le code de votre application Flask dans le conteneur Docker
> COPY . /app
> 
> # Définir la variable d'environnement FLASK_APP
> ENV FLASK_APP=app.py
> ENV FLASK_DEBUG=true
> ENV FLASK_ENV=deployement
> 
> # Exposez le port sur lequel votre application Flask écoute
> EXPOSE 8000
> EXPOSE 443
> # Lancez l'application Flask
> CMD ["sh", "-c", "sleep 5 &&  mod_wsgi-express start-server wsgi.py 
> --https-port 443 --server-name givemeasign.unamurcs.be --ssl-certificate-file 
> cert.pem --ssl-certificate-key-file key.pem --user www-data --group www-data"]
> 
> and here is my docker-compose.yaml file : 
> # creating a volume to be able to persist data between Postgres container 
> restarts
> volumes:
>   users-vol:
> 
> services:
> 
>   pgsql:
>     image: postgres:12.11
>     restart: always
>     environment:
>       POSTGRES_PASSWORD: pwd # environment variable that sets the superuser 
> password for PostgreSQL
>       POSTGRES_USER: usr # variable that will create the specified user
>       POSTGRES_DB: users # the name of your db
>     volumes:
>       - users-vol:/var/lib/postgresql/data
>     ports:
>       - 5432:5433
> 
>   
>   python:
>     build: 
>       context: .
>       dockerfile: ./Dockerfile
>     depends_on:
>       - pgsql
>     ports:
>       - 8000:8000
>       - 443:443
>     
> 
> 
> When i build the docker, everything is good as you can see in the second 
> picture.
>  <Capture d’écran 2023-05-15 115058.png>
> My problem is that i can access to the http link and everything is work well 
> instead of the error i mentionned before wit the "mixed content" but i can't 
> load the https website and i don't know why. Maybe i made a mistake somewhere 
> 
> I hope that i will find some help here because that's for an exam and 
> everthing is working locally. The only problem is on the the deployment. 
> 
> Kind regards,
> Babacar
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/5327b2d6-f34b-4418-b324-54a6754969c2n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/5327b2d6-f34b-4418-b324-54a6754969c2n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> <Capture d’écran 2023-05-15 115247.png><Capture d’écran 2023-05-15 115058.png>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/5EEB784F-C52E-40EF-943C-DAAB03219DC1%40gmail.com.

Reply via email to