Reputation: 75
I'm serving my app from a custom domain. I don't want it to be available at the appspot.com domain. What's the easiest way to achieve this? I'd like to be able to do it at the console level, but I have feeling I'll have to configure it in the app. The app is written in Java. Thanks.
Upvotes: 3
Views: 837
Reputation: 75
In the end I did something like this:
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
if (req.getRequestURL().toString().startsWith ("http://1-dot-")) {
resp.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
resp.setHeader("Location", "[my custom domain]");
}
}
Upvotes: 0
Reputation:
Use a custom ServletFilter
to check the HttpServletRequest.getRequestURL()
to see if it matches the appspot.com
domain and return a 404 Not Found
.
The filters are applied in the order they are listed in the web.xml
so make sure this one is the first one.
Upvotes: 1