-
Notifications
You must be signed in to change notification settings - Fork 1
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
GN-4435: Use cool-uri
to create permalink for zitting
#34
Conversation
config/dispatcher/dispatcher.ex
Outdated
Proxy.forward conn, ["?uri=http://permalink", "zitting", id], "http://cooluri" | ||
end | ||
|
||
match "/permalink/*path", @any do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see the actual uri of the requested resource used here, as discussed on rocket (if possible)
this means any visitor could visit https://publicatie.gelinkt-notuleren.vlaanderen.be/permalink?uri=<uri>
and get the content for that resource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we can use actual URI, why I got confused is because I've first approached this from the point of using it just for redirecting access to {HOST}/Aalst/Gemeente/zitting/b2f47ed1-3534-11e9-a984-7db43f975d75
, in that case we only have mu:uuid
of zitting, which does not correspond to uh the uh ... letter/number combination in the URI, so cannot be referenced to the correct URI via cool-uri
service directly
![CleanShot 2023-10-06 at 14 28 10@2x](https://private-user-images.githubusercontent.com/769698/273194473-ecd445ff-2ccc-40b3-95f1-5bc35eb5ec31.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjQyNjksIm5iZiI6MTczOTU2Mzk2OSwicGF0aCI6Ii83Njk2OTgvMjczMTk0NDczLWVjZDQ0NWZmLTJjY2MtNDBiMy05NWYxLTViYzM1ZWI1ZWMzMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQyMDEyNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mMjQ4YmU2NmEyMzhkYWY5YmYzMjJkZGUxN2VmNjcwOWI0ZmQ0ODdmNjg1YWM5NDhjZmJjZTVhZjNiZmJiODk2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.FJwDXlyNMCqlkzDcDaFQe4SJBUnvDzz36LXHAQKq5bc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to work via /permalink?uri=<uri>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR description as well
- Try to access http://localhost:8080/Huldenberg/Gemeente/zitting/b2f47ed1-3534-11e9-a984-7db43f975d75, confirm you are redirected to http://localhost:8080/Huldenberg/Gemeente/zittingen/b2f47ed1-3534-11e9-a984-7db43f975d75 (note
zitting
vszittingen
in URL) - Try to access http://localhost:8080/permalink?uri=http://data.lblod.info/id/zittingen/8c93d2cc-f4ba-4444-b09e-b7495e336ff8, confirm you are redirected to http://localhost:8080/Huldenberg/Gemeente/zittingen/b2f47ed1-3534-11e9-a984-7db43f975d75
- Call
curl -v http://localhost:8080/permalink?uri=http://data.lblod.info/id/zittingen/8c93d2cc-f4ba-4444-b09e-b7495e336ff8
, confirm you getHTTP/1.1 303 See Other
andlocation: /Huldenberg/Gemeente/zittingen/b2f47ed1-3534-11e9-a984-7db43f975d75
in the response headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right in thinking the behaviour after the initial redirect isn't defined yet? Locally I get a strange 307 redirect after the first one (using httpie), e.g.
http :8080/Huldenberg/Gemeente/zitting/4b60e8f1-3532-11e9-a984-7db43f975d75
# HTTP/1.1 303 See Other
# location: /Langemark-Poelkapelle/Gemeente/zittingen/4b60e8f1-3532-11e9-a984-7db43f975d75
http :8080/Langemark-Poelkapelle/Gemeente/zittingen/4b60e8f1-3532-11e9-a984-7db43f975d75
# HTTP/1.1 307 Temporary Redirect
# location: //localhost:8080/Langemark-Poelkapelle/Gemeente
config/dispatcher/dispatcher.ex
Outdated
############### | ||
|
||
# This will catch calls to links like {HOST}/Aalst/Gemeente/zitting/b2f47ed1-3534-11e9-a984-7db43f975d75 | ||
match "/:bestuurseenheid_naam/:bestuurseenheid_classificatie_code_label/zitting/:id", @any do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I missing something about how mu-dispatcher
matches paths, or would this cause problems if we ever had a route in the UI which had 2 parts and then the word zitting
? I feel like there should be a literal first part of the path to avoid collisions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it would. Current FE also has similar capture route (https://github.com/lblod/frontend-gelinkt-notuleren-publicatie/blob/master/app/router.js#L13), so it kinda works in the same way 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# HTTP/1.1 307 Temporary Redirect
# location: //localhost:8080/Langemark-Poelkapelle/Gemeente
I am not exactly sure but that looks like the Ember intercepting and redirecting when there is no actual zitting with that ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that was for an id I got from the triplestore though, so I thought it should exist, unless I managed to use the wrong id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I for one can't reproduce your issue @piemonkey
I get a 301, which is correct, and --follow
can follow nicely
* Redirect calls like `{HOST}/Aalst/Gemeente/zitting/b2f47ed1-3534-11e9-a984-7db43f975d75` directly to "zitting" instead of using `cool-uri` * Update `/permalink` endpoint to expect `uri` query param
also redirects all further paths after /zitting, not just /zitting/:id
Overview
GN-4435: Use
cool-uri
to create permalink forzitting
Setup
cool-uri
service to provide permalinks forzitting
(and other entities via/permalink
)connected issues and PRs:
https://binnenland.atlassian.net/browse/GN-4435
lblod/besluit-publicatie-publish-service#11
Setup
besluit-publicatie-publish-service
docker-compose.override.yml
Where
<LOCATION_OF_BESLUIT_SERVICE>
is folder where thebesluit-publicatie-publish-service
is checked outdocker compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.override.yml up
How to test/reproduce
Confirm that migration was executed by running below query at http://localhost:8080/sparql
zitting
vszittingen
in URL)curl -v http://localhost:8080/permalink?uri=http://data.lblod.info/id/zittingen/8c93d2cc-f4ba-4444-b09e-b7495e336ff8
, confirm you getHTTP/1.1 303 See Other
andlocation: /Huldenberg/Gemeente/zittingen/b2f47ed1-3534-11e9-a984-7db43f975d75
in the response headersConfirm that besluit service is inserting permalink by either publishing something from GN, if you have it setup, or going to http://localhost:8080/sparql and executing following query
Then after running
You should be able to observe something like this, note that the ID part of the URL will be different
Checks PR readiness