This sounds like a good use case for nginx or a reverse proxy rather than dropwizard. It would be a bit odd for dropwizard to redirect the domain root context to its application context as there could be and typically are other services living behind a single domain. I am by no means a Heroku expert but it feels like the responsibility of the root domain should live with something on the network layer rather than the application layer.
--Bobby Johansen Sent via Superhuman ( https://sprh.mn/[email protected] ) On Tue, May 05, 2020 at 8:36 PM, Joe Barnett < [email protected] > wrote: > > Hello, > > > We're using SimpleServerFactory and running on heroku, and would like the > root url (eg https:/ / my-dropwizard-app. herokuapp. com ( > https://my-dropwizard-app.herokuapp.com/ ) ) to redirect to the > applicationContextPath (eg https:/ / my-dropwizard-app. herokuapp. com/ > application > ( https://my-dropwizard-app.herokuapp.com/application ) ) rather than > always return a 404. It looks like this can be done by subclassing > SimpleServerFactory and overriding the `build` method to copy/paste > everything with an additional `ContextRoutingHandler` map entry that > handles "/" with a Handler that returns a 302 redirect to the > applicationContextPath, but would prefer to not have to duplicate the > `build` method logic. Is there a hook that we're missing that would solve > this issue differently? If not, would it make sense to add a way for > applications to configure the SimpleServerFactory to handle the root URI? > > > Thanks, > -Joe > > > > > > -- > You received this message because you are subscribed to the Google Groups > "dropwizard-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to dropwizard-user+unsubscribe@ googlegroups. com ( > [email protected] ). > To view this discussion on the web visit https:/ / groups. google. com/ d/ > msgid/ dropwizard-user/ d916938d-cd43-425b-867e-e1ec6e80d864%40googlegroups. > com ( > https://groups.google.com/d/msgid/dropwizard-user/d916938d-cd43-425b-867e-e1ec6e80d864%40googlegroups.com?utm_medium=email&utm_source=footer > ). > -- You received this message because you are subscribed to the Google Groups "dropwizard-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/k9vgf4q6.31edb5c5-791e-488e-8848-a12aa8893d02%40we.are.superhuman.com.
