geocollections / geocase-thumbnail

GNU General Public License v3.0
0 stars 0 forks source link

Create micro service for images #1

Open falkogloeckler opened 3 years ago

falkogloeckler commented 3 years ago

We need a micro service that helps:

enmust commented 3 years ago

I made a new repo for this service: geocase-thumbnail.

git-arbitrarysystems commented 3 years ago

The service is now available at http://gc-thumbs.test.code.naturkundemuseum.berlin @enmust Can you connect it to the API on your side and see if is works?

Here are some links for testing: List all cached images Delete all images from the cache image 1 image 2 image 3

enmust commented 3 years ago

I added it to the API but I can't properly create/view or delete thumbnails.

When I try to add it just returns 'error 404 page not found' or 'error 400 imaginary request url'. Adding a thumbnail only worked when posting from localhost or from your url (maybe https issue or sth) but I had to encode it beforehand. + deletion only works using wildcard.

git-arbitrarysystems commented 3 years ago

I saw. I cannot really say what the issue might be. Maybe you're doubly encoding the url part of the path? If cannot see what happens in the API so i cannot really debug it from this side. Would you like to setup a zoom meeting?

enmust commented 3 years ago

In node app I am just proxying your url using http-proxy-middleware: https://geocase-api.geocollections.info/v1/thumbnail-service/

For testing purposes to check if the same problem still persists I added a proxy to nginx conf: https://geocase-api.geocollections.info/thumbnail-service-test/ image

For example: I can't add this image: https://files.geocollections.info/86/09/86096e07-da24-449a-8edd-a670d5b3e906.jpg to thumbnail cache.

Your url

Doesn't work: http://gc-thumbs.test.code.naturkundemuseum.berlin/thumbnail/https://files.geocollections.info/86/09/86096e07-da24-449a-8edd-a670d5b3e906.jpg

Does Work (have to encode beforehand): http://gc-thumbs.test.code.naturkundemuseum.berlin/thumbnail/https%3A%2F%2Ffiles.geocollections.info%2F86%2F09%2F86096e07-da24-449a-8edd-a670d5b3e906.jpg

In api

I can view all: https://geocase-api.geocollections.info/v1/thumbnail-service/thumbnails and delete all https://geocase-api.geocollections.info/v1/thumbnail-service/thumbnail/delete/* but I can't add or view existing ones.

Doesn't work: https://geocase-api.geocollections.info/v1/thumbnail-service/thumbnail/https%3A%2F%2Ffiles.geocollections.info%2F86%2F09%2F86096e07-da24-449a-8edd-a670d5b3e906.jpg

I also just tested adding proxy to a non https connected site and it still had the same problem. Therefore it seems like the issue might be related to a proxy.

enmust commented 3 years ago

Just an idea: maybe it would be better to add url to query + also I think we should be able to get image using raw url. For example this url could return thumbnail: http://gc-thumbs.test.code.naturkundemuseum.berlin/thumbnail/?url=https://files.geocollections.info/86/09/86096e07-da24-449a-8edd-a670d5b3e906.jpg

git-arbitrarysystems commented 3 years ago

I updated the service to take ?url=... parameters as replacement for /url

You can use a raw URL but generally speaking i think URLs should be encoded prior to sending. This is because URLs containing their own URL-parameters will not work in GET requests otherwise ( For instance: https://www.nms.ac.uk/search.axd?command=getcontent&server=Detail&value=PF30267 )

I hope it works

Here are some links for testing: List all cached images Delete all images from the cache image 1 image 2 image 3