Closed Melissa37 closed 5 years ago
For me, PDFs loaded from the http://localhost:8080/
URL when running Docker locally. I think to fix this will be in the demo site with some configuration, if you are viewing a live demo site?
Yes, I am using: https://demo--ijm.elifesciences.org/articles
Probably a similar issue to https://github.com/microsimulation/demo/pull/10 but let's solve that first and we'll check where this other hardcoded URL comes from (if it's not already covered).
Not entirely sure where the download configuration is from yet, I am following it to see.
The IJM content is similar to this line from the example branch https://github.com/microsimulation/demo/blob/example/api/data/articles/04395.json#L164
"pdf": "http://web:8082/04395/elife-04395-fig1-v2.tif"
I followed that pattern when generating IJM JSON files.
E.g.
https://github.com/microsimulation/demo/blob/master/api/data/articles/00001.json#L15
"pdf": "http://web:8082/00001/ijm-00001.pdf",
Uhm
http://demo--ijm.elifesciences.org/download/aHR0cDovL3dlYjo4MDgyLzAwMDUzL2lqbS0wMDA1My5wZGY=/ijm-00053.pdf?_hash=B5BO4Z7yWQiD1gIrsfInUViscVdKIJclwfKseD%2FFbKg%3D
works whereas the original link
http://localhost:8080/download/aHR0cDovL3dlYjo4MDgyLzAwMDUzL2lqbS0wMDA1My5wZGY=/ijm-00053.pdf?_hash=B5BO4Z7yWQiD1gIrsfInUViscVdKIJclwfKseD%2FFbKg%3D
doesn't as localhost
can't resolve.
What should happen, I think, is that the hostname here resolves to the journal
container and that proxies the request to the web:8082
that you have used. web:8082
only resolves from inside containers.
I think the problem is in the proxying that does not forward headers such as Host
or X-Forwarded-Host
.
Symfony ignores my attempts to set Host
or X-Forwarded-Host
with proxy_set_header
.
As far as I can understand the settings in https://symfony.com/doc/3.4/console/request_context.html are only defaults so we can't go that route either.
Added Request::setTrustedProxies([$_SERVER['REMOTE_ADDR']], Request::HEADER_X_FORWARDED_ALL);
which doesn't help either.
https://github.com/microsimulation/demo/pull/13 https://github.com/elifesciences/microsimulation-demo-formula/pull/4 seem to work for me, HTTPS pending as that can only be tested on AWS.
IIIF images have similar problems still, but the resolution needs to wait on the proxying fixes as they will need to be proxied as well to add HTTPS.
Finally fixed PDF links; images are a different matter.
Cool, thanks @giorgiosironi and others. It works for me on the demo site.
I suspect api_url_public
is unused? We can allow public access without configuring it in journal.
Images fixed via more proxying.
Think this can be closed now.
Click on PDF, then replaces currently page with: