Skip to content

Adds the possibility to change the USE_TLS_RESPONSE HTTP response#709

Open
Leon-Schwandt wants to merge 2 commits intoapache:mainfrom
Leon-Schwandt:main
Open

Adds the possibility to change the USE_TLS_RESPONSE HTTP response#709
Leon-Schwandt wants to merge 2 commits intoapache:mainfrom
Leon-Schwandt:main

Conversation

@Leon-Schwandt
Copy link
Copy Markdown

Enables the USE_TLS_RESPONSE message to be changed at a global level. A possible use case would be a redirect to HTTPS

@tobiasbaum
Copy link
Copy Markdown

I would like to see this feature added to Tomcat. Does anyone know the reason why it has not been merged, yet?

Some background on my use case:

When I have a secure (https) connector listening on some port (say 8080) and I accidentally call it without TLS (e.g., http://localhost:8080/ instead of https://localhost:8080/), I get an error response as follows:
Bad Request
This combination of host and port requires TLS.

For non-technical users, this error response is not ideal. Therefore, I would like to be able to configure this response. Ideally in my case, the response would be a redirect that changes the protocol from http to https and leaves the remaining url the same. But serving a custom static HTML response would be sufficient, too (as I could then, e.g., implement the redirect in JavaScript or provide a user-friendly explanation). Also, in my case, configuration via code would be sufficient as I run Tomcat embedded as a library.

@Leon-Schwandt
Copy link
Copy Markdown
Author

This is my first pull request in a public repository, so I don’t have much experience with this yet. Since I didn’t receive any response to my pull request for months, I didn’t follow up on it. That’s why I didn’t notice the merge conflict. I’d also be interested to know why my PR hasn’t been merged yet; exactly what @tobiasbaum described was also my thought, which is why I created the PR two years ago.

Enables the USE_TLS_RESPONSE message to be changed at a global level. A possible use case would be a redirect to HTTPS
@Leon-Schwandt
Copy link
Copy Markdown
Author

I've rebased the PR onto the current main branch and resolved all merge conflicts (including removing changes to SecureNio2Channel.java since NIO2 was dropped in Tomcat 12).

@rmaucher
Copy link
Copy Markdown
Contributor

This seems to have no practical use as is. There needs to be another mechanism to implement this otherwise it's clearly not an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants