Skip to content
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

Calling routes with / in the end will not give response #134

Open
imadbourouche opened this issue Feb 23, 2025 · 6 comments
Open

Calling routes with / in the end will not give response #134

imadbourouche opened this issue Feb 23, 2025 · 6 comments
Labels

Comments

@imadbourouche
Copy link
Member

How to reproduce

  • Run the api ./bin/ontoportal dev

  • calling localhost:9393/ontologies will work fine
    Image

  • Calling localhost:9393/ontologies/ will not work
    Image

@imadbourouche
Copy link
Member Author

imadbourouche commented Feb 25, 2025

@syphax-bouazzouni do you know why this is happening ? because when i run the the UI and link it with the API locally it's not working (errors when calling /projects/) and in the api it's doing the redirection so not working) ? or this is just happening locally ?
one of the solution is to add /? in the routes but we have lot of routes

@syphax-bouazzouni
Copy link

syphax-bouazzouni commented Feb 25, 2025

it was removed here 4c824a3, in the file init.rb, before /ontologies and /ontologies/ were the same. Now it is not /ontologies is correct, /ontologies/ is not correct and redirected to /ontologies

@imadbourouche
Copy link
Member Author

it was removed here 4c824a3, in the file init.rb, before /ontologies and /ontologies/ were the same. Now it is not /ontologies is correct, /ontologies/ is not correct and redirected to /ontologies

yeah but by this logic if we call /ontologies/ it will redirect to /ontologies/ and it will be infinit redirection because redirect request.path_info.to_s, 301 will redirect to the same path.

i'll fix the logic so that we redirect to the path without /, but this is not good because it will make additional redirection when calling /ontologies/

@syphax-bouazzouni
Copy link

ontologies/

I couldn't make it work, as the before behavior is no more supported in the latest version of Sinatra, if you can make it as before, it will be great.

And does not do a infinite loop, it is already deployed in AgroPortal API and work, you can test it.

@imadbourouche
Copy link
Member Author

I couldn't make it work, as the before behavior is no more supported in the latest version of Sinatra, if you can make it as before, it will be great.

yeah i'll try to fix it.

And does not do a infinite loop, it is already deployed in AgroPortal API and work, you can test it.

I test it in agroportal API and also it's not working, try calling https://data.agroportal.lirmm.fr/ontologies/?apikey=1de0a270-29c5-4dda-b043-7c3580628cd5

Image

@syphax-bouazzouni
Copy link

Ah yeah, the issue is that it redirect to HTTP not HTTPS, and didn't remove the '/' at the end.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants