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

support 301 redirect #5220

Open
ticapix opened this issue Dec 22, 2024 · 0 comments
Open

support 301 redirect #5220

ticapix opened this issue Dec 22, 2024 · 0 comments
Labels
🐞 bug issue is a bug

Comments

@ticapix
Copy link

ticapix commented Dec 22, 2024

Current Behavior

I have an instance of eclipse/rdf4j-workbench:5.1.0-tomcat deployed on a node on my local network, lets say rdf4j.lan:8000.

This node is exposed to the WWW via a nginx proxy at https://rdf4j.myhomelab.org

When I directly use http://rdf4j.lan:8000/rdf4j-workbench/, all the operations (create/update/query/browse/delete) are working great.

When I use https://rdf4j.myhomelab.org/rdf4j-workbench/, and I try to delete a repository, I have a 500 error with the following message:

org.eclipse.rdf4j.repository.RepositoryException: <html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>openresty</center>
</body>
</html>
	org.eclipse.rdf4j.http.client.SPARQLProtocolSession.execute(SPARQLProtocolSession.java:1095)
	org.eclipse.rdf4j.http.client.SPARQLProtocolSession.executeNoContent(SPARQLProtocolSession.java:1049)
	org.eclipse.rdf4j.http.client.RDF4JProtocolSession.upload(RDF4JProtocolSession.java:1101)
	org.eclipse.rdf4j.http.client.RDF4JProtocolSession.upload(RDF4JProtocolSession.java:926)
	org.eclipse.rdf4j.http.client.RDF4JProtocolSession.removeData(RDF4JProtocolSession.java:911)
	org.eclipse.rdf4j.repository.http.HTTPRepositoryConnection.removeModel(HTTPRepositoryConnection.java:584)
	org.eclipse.rdf4j.repository.http.HTTPRepositoryConnection.flushTransactionState(HTTPRepositoryConnection.java:633)
	org.eclipse.rdf4j.repository.http.HTTPRepositoryConnection.commit(HTTPRepositoryConnection.java:326)
	org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection.conditionalCommit(AbstractRepositoryConnection.java:321)
	org.eclipse.rdf4j.repository.http.HTTPRepositoryConnection.clear(HTTPRepositoryConnection.java:697)
	org.eclipse.rdf4j.workbench.commands.ClearServlet.doPost(ClearServlet.java:40)
	org.eclipse.rdf4j.workbench.base.TransformationServlet.service(TransformationServlet.java:98)
	org.eclipse.rdf4j.workbench.base.AbstractServlet.service(AbstractServlet.java:129)
	org.eclipse.rdf4j.workbench.proxy.ProxyRepositoryServlet.service(ProxyRepositoryServlet.java:100)
	org.eclipse.rdf4j.workbench.proxy.WorkbenchServlet.service(WorkbenchServlet.java:214)
	org.eclipse.rdf4j.workbench.proxy.WorkbenchServlet.handleRequest(WorkbenchServlet.java:136)
	org.eclipse.rdf4j.workbench.proxy.WorkbenchServlet.service(WorkbenchServlet.java:111)
	org.eclipse.rdf4j.workbench.proxy.WorkbenchGateway.service(WorkbenchGateway.java:119)
	org.eclipse.rdf4j.workbench.base.AbstractServlet.service(AbstractServlet.java:129)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:115)
	org.eclipse.rdf4j.workbench.proxy.CacheFilter.doFilter(CacheFilter.java:64)
	org.eclipse.rdf4j.workbench.proxy.CookieCacheControlFilter.doFilter(CookieCacheControlFilter.java:56)

Other operation to create/update/query/browse are working fine using the https endpoint.

Expected Behavior

I would expect 2 things:

  1. the repository to use "https://" scheme, like for the server, instead of downgrading to "http".
    image

  2. the PUT and DELETE operations to support and follow 301 redirects

logs from the nginx reverse proxy, receiving http requests from the RDF4J workbench and replying with a 301 HTTP code, not being followed, resulting with a 500.

[22/Dec/2024:10:47:34 +0000] - - 301 - PUT http rdf4j.myhomelab.org/ "/rdf4j-server/repositories/nuts2024/transactions/eeecc4ed-2acb-44cb-a8b7-0a3dc6ccd71a?preserveNodeId=true&action=DELETE" [Client 172.21.0.1] [Length 166] [Gzip -] [Sent-to rdf4j.lan] "Apache-HttpClient/4.5.14 (Java/17.0.13)" "-"
[22/Dec/2024:10:47:34 +0000] - - 301 - DELETE http rdf4j.myhomelab.org/ "/rdf4j-server/repositories/nuts2024/transactions/eeecc4ed-2acb-44cb-a8b7-0a3dc6ccd71a" [Client 172.21.0.1] [Length 166] [Gzip -] [Sent-to rdf4j.lan] "Apache-HttpClient/4.5.14 (Java/17.0.13)" "-"
[22/Dec/2024:10:47:34 +0000] - 500 500 - POST https rdf4j.myhomelab.org/ "/rdf4j-workbench/repositories/nuts2024/clear" [Client 172.21.0.1] [Length 4534] [Gzip -] [Sent-to rdf4j.lan] "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0" "https://rdf4j.myhomelab.org/rdf4j-workbench/repositories/nuts2024/clear"

Steps To Reproduce

  1. deploy the workbench on a local node
  2. expose the local node behind a reverse https proxy
  3. use the public exposed https endpoint to access and use the workbench
  4. create a repository
  5. try to delete it

Version

5.1.0

Are you interested in contributing a solution yourself?

Yes

Anything else?

Of course, this is happening because I force HTTPS on the reverse proxy.

If I don't force HTTPS, there is no bug because there is no 301 redirect.

@ticapix ticapix added the 🐞 bug issue is a bug label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug issue is a bug
Projects
None yet
Development

No branches or pull requests

1 participant