zimeon / iiif

IIIF Image API reference implementation and Python library
GNU General Public License v3.0
55 stars 15 forks source link

Changing the base URI for the image api #36

Open glenrobson opened 6 years ago

glenrobson commented 6 years ago

I've deployed this as the image reference implementation but when you get the info.json the @id of the image starts with http://resync.library.cornell.edu/iiif_auth_test. Is there a way to set this either as part of the deployment or as a parameter? You can see an example of this by going to:

http://iiif.io/api/image/2.1/example/reference/detail/info.json

Ideally this would be either:

I see the comment in the code about taking it from the WSGI but that won't work in this case as its running from image-api.iiif.io and proxied through the iiif.io website. Unless I can set a variable in the WSGI config file.

For info this is the docker build file:

https://github.com/IIIF/docker-image-api-reference/blob/master/Dockerfile

zimeon commented 6 years ago

Hmmm... the WSGI support was a bit of a hack that I got going as a test and never really sorted out. I agree that there needs to be a way to do sensible config.

zimeon commented 4 years ago

https://iiif.io/api/image/2.1/example/reference/detail/info.json now shows

"@id": "http://iiif.io/api/image/2.1/example/reference/detail",

and https://iiif.io/api/image/3.0/example/reference/detail/info.json shows

"id": "http://iiif.io/api/image/3.0/example/reference/detail",

which look good. Not sure whether there is still something to do here.

glenrobson commented 4 years ago

Yes this works great. Just because it took me a while to find out how this worked. The file path

/api/image/[1-3].[0-1]/example/reference/[file_name]/info.json

is fixed in:

https://github.com/zimeon/iiif/blob/3cc6a424a159abcc61143e593b36304de04105b3/iiif_reference_server.py#L73

Which is fine for my uses. The thing I needed to change was the hostname and I believe you updated the following:

https://github.com/zimeon/iiif/blob/975f1bc30d6f19f5e168e771a7b20dacfbdc0185/iiif_reference_server.wsgi#L27

to take a config file where I could set this. Which I have done in the following config:

https://github.com/IIIF/docker-image-api-reference/blob/master/iiif_reference_server.cfg

So I think this is done and can be closed.

glenrobson commented 4 years ago

Sorry, just looking further into this and would it be possible to set the scheme in the config as well? This is the only thing that is failing the IIIF validator:

https://iiif.io/api/image/validator/results/?server=https%3A%2F%2Fiiif.io&prefix=%2Fapi%2Fimage%2F3.0%2Fexample%2Freference%2F&identifier=67352ccc-d1b0-11e1-89ae-279075081939&version=3.0&level=1&id_basic=on&id_squares=on&info_json=on&id_error_escapedslash=on&id_error_random=on&id_error_unescaped=on&id_escaped=on&region_error_random=on&region_pixels=on&size_nofull=on&region_square=on&size_ch=on&size_error_random=on&size_noup=on&size_region=on&size_wc=on&size_wh=on&rot_error_random=on&quality_error_random=on&format_jpg=on&format_error_random=on&baseurl_redirect=on&cors=on&jsonld=on

I need to set the id in the info.json to

https://iiif.io/api/image/3.0/example/reference/67352ccc-d1b0-11e1-89ae-279075081939"

as its currently set as http://...

glenrobson commented 4 years ago

Ideally I would also set this in the config:

https://github.com/IIIF/docker-image-api-reference/blob/master/iiif_reference_server.cfg

glenrobson commented 4 years ago

Is it set here:

https://github.com/zimeon/iiif/blob/975f1bc30d6f19f5e168e771a7b20dacfbdc0185/iiif/flask_utils.py#L159