tech5usa / TLSential

A server for providing short-lived TLS certificates to all services within a firewall restricted network.
GNU General Public License v3.0
15 stars 2 forks source link

Debus/issue 39 #40

Closed debus closed 4 years ago

debus commented 4 years ago

This PR addresses the following issues:

https://github.com/ImageWare/TLSential/issues/39

Context

By default the router treats "/somepath/" differently than "/somepath" so we have to use some hacky workarounds to get those urls to route to the same handler. This fixes that issue.

Approach

All requests are first handled by a function that removes the trailing slash of the request URL before the request is sent off for its regularly scheduled routing. The only URL treated specially is "/". The slash isn't removed in this case as it causes an infinite redirect loop do the server redirecting requests with no path to "/" (which we then remove, making the server think the client didn't respond to the redirect request)

Testing

Made sure all the URLs responded normally. And made sure they responded the same way if I added a slash to the end.

Misc.

We definitely want to remember to add tests for requests like / because the go tests obviously didn't catch the infinite redirect issue.