-
-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't ask Gotenberg to fetch url from docker with multi-domain app #116
Comments
Hello @Pierstoval In a Docker Compose network, the hostname of a service is the service name directly. |
@LoicHa The problem I have is not related to how I connect to Gotenberg from my PHP client or with Curl, because I already use the Gotenberg container's name as host and I can call it. The problem is that Gotenberg can't connect to my PHP app because of how domain names are handled. @gulien as said, when I do this, Gotenberg will effectively call This could be solved if we could customize how Gotenberg itself makes the call to the container. As said, if it used curl for example, I could add options to curl to make sure the called hostname is Maybe Gotenberg could propose a new form option that would contain a JSON string with an |
Indeed, being able to set custom headers for Related with #81. A workaround solution would be to use some kind of "proxy": Gotenberg => proxy (send request with correct headers) => app |
Hello folks!
I've just discovered Gotenberg and I configured it in my
docker-compose.yaml
file, the exposed port is okay, and I can generate PDFs from remote URLs.However, it only works with remote urls.
Let me explain.
I have a PHP application which must be multidomain.
Let's consider such Compose config:
I'll need to generate PDFs from the
app
container, therefore I will execute something like this from inside this container:However, this will not work:
gotenberg
's container doesn't know anything about themydomain.docker
host, so I end up having a blank page inresult.pdf
.By the way, any
curl
call to the same address will result in acurl: (7) Failed to connect to mydomain.docker port 8000: Connection refused
error.I even tried
echo "mydomain.docker app" >> /etc/hosts
, without success (doesn't seem to be taken in account at all).I could find a hack that would have worked with Curl, by "mocking" the host:
Using this trick,
curl
will effectively call theapp
host (the same as the app's container name, valid inside a Docker network), but the resolved host will bemydomain.docker
. It just works withcurl
.However, it does not go beyond as this trick does not seem to be possible with Gotenberg.
If it was possible to use Gotenberg without a separate Docker container, it would probably be easier, as I could directly install it in the
app
container and make all queries "from inside" (it would make the image heavier but would be worth it IMO). But I'm not sure copy/pasting config and setup from your repository would be worth it nor maintainable.I also tried using the
/html
endpoint, but there are so many CSS, JS and images in the web page that I don't even know how I can achieve that without hundreds of lines of code full of hacks or overengineered stuff.What I'm almost sure about is that it would probably work in production. I don't use any "complex" setup (just have one dedicated server) so running the docker image alongside all other apps seems pretty okay, and as it would call totally remote addresses (with proper DNS-based hosts), it would work without harm. But for dev, it's not possible.
I'm starting to think that I won't be able to use Gotenberg at all with the setup I have...
Do you have any idea of how I could solve this?
As a side-note, I have chromium installed on the main Docker image (necessary to use Panther for testing).
Should I look further there?
The text was updated successfully, but these errors were encountered: