After I apply certbot and try to access the https link credentials, this error appears:
Http failure response for http://y.y.y.y.:9090/bc-pr/authentication/login: 0 Unknown Error
That is, it won't let me log in anymore
I read here on the site that certbot only recognizes the frontend and you need to enter a path so that the backend (in my case on the same server) also has the certificate
After I request the certificate with certbot when from the browser I access https://www.example.com the main screen appears but when I go to log in this error appears:
Http failure response for http://y.y.y.y.:9090/bc-pr/authentication/login: 0 Unknown Error
Without the certificate, therefore before running the certbot, in http it did not give any errors.
At this link Using let's encrypt in the backend server - #3 by _az I read that to configure the certificate to the backend you need to add location /.well-known/ acme-challenge/ {, because certbot recognizes only for one certificate and here it is also necessary to assign the certificate to the backend in my case to proxy_pass http://x.x.x.x:9090/bc-pr;
So it's a certificate error i.e. configuring nginx for certbot and I don't know how to do it I tried with that link but it doesn't work.
That post is about forwarding the HTTP challenge request from a frontend server to a backend server. i.e. If you wanted to run Certbot on x.x.x.x (which I assume is a separate server to the one where nginx is running) in order to obtain a certificate, that would enable you to do so.
The error message you are seeing appears to be coming from your web application. I can't comment on that because I don't know what the application is, how it works, or what it is expecting to happen.
To be honest, I do not really understand what you are trying to achieve. It might help to explain clearly and in detail, the architecture of your setup, what web applications you are trying to run, and how you want the SSL certificate setup to look.
Proxying applications that expect HTTPS to be used can be complicated. It depends on the application.
Sometimes, it is enough to just forward a X-Forwarded-Proto header while still proxying in insecure HTTP, and the backend application will be happy.
Other times, you will need to actually use HTTPS on the backend. In that case, you need to set up Tomcat (and the other application) with SSL certificates, and change:
and
to be HTTPS URLs, on the HTTPS ports of the backends.
So we have two docker containers one which is front end and the other back end. It may be that one tomcat has been configured for https and the other is not, would you like to tell me this?
If the frontend and the backend are running on the same hardware, and the backend isn't exposed to the public, I'd question the purpose of using https for the backend at all, let alone trying to use a public cert (which will still give certificate errors, because you'll be connecting to the backend via IP address, and the cert covers FQDNs). What's the point here?
Yes they are on the same machine but they are on docker container. So it's not possible to configure the backend on the same machine as the front end even if they are on different docker containers?
How did you conclude this from what I wrote? Of course it's possible to do that; you've already done it. What I'm saying is that trying to configure https for the backend is just a waste of your time.
Yes forgive me I know I did it because I thought I could. So the backend with https on the same hardware is not possible I understand this I'm not saying the opposite I'm asking for confirmation as I'm not an expert
That isn't the case either, but I just don't see any reason to do it. But if you do, you'll almost certainly end up with certificate validation failures on the frontend, so you'll need to configure it to ignore those when communicating with the backend.
And, probably my fault, I don't understand how what you wrote is supposed to proxy requests to the frontend to one Docker container and requests to the backend to another in nginx.
But if I understood you correctly, you want a certificate for internal use for the backend that can only be reached internally. But either the backend can be reached under a public domain for which the certificate is issued, or the internal backend is addressed internally via a different domain/IP address and then the certificate is not valid for it.
But as I said, I don't really understand all of this, at least with the information provided.
And to answer the topic question: How can I create my own certificate for the backend as well?
Since the cert would already be within the same system...
Just copy it from one [container] to the other [container].