I'm currently working on a testing environment for a project. Locally everything works as it should, but when I try to log into the installed testing environment Google Chrome throws an HTTP ERROR 403
even though I haven't used the forbidden()
anywhere in the code. The Login works on Firefox or IE11.
Requests reach the application through a proxy server running nginx
.
I also do have a valid SSL Certificate.
I've implemented the Login with the Play! Framework
Forms and Form-Helpers.
I tried to find where the POST request throws the error (on the installed instance), so I added some System.out.println()
lines, but the POST request doesn't even reach the controller (println() on first line of POST never prints anything when accessed on Chrome).
I've already tried to restart nginx, delete cached data, access the application with the inkognito-tab or guest user. Nothing worked.
What do I need to change or configure differently so Chrome stops responding with forbidden even though it works on other browsers?
Routes:
GET /login com.informaticon.web.ticketsystem.controllers.LoginController.get(request: Request)
POST /login com.informaticon.web.ticketsystem.controllers.LoginController.post(request: Request)
Twirl template:
@helper.form(action = LoginController.post()) {
<div class="login-form">
<p class="login-title">Testsystem</p>
@CSRF.formField
@helper.inputText(field = form(LoginForm.FIELD_USERNAME), 'class -> "login-input", '_label -> "Username")
<br>
@helper.inputPassword(field = form(LoginForm.FIELD_PASSWORD), 'class -> "login-input",'label -> "Password")
<button class="login-form-button" type="submit" name="login-button">
Log in
</button>
</div>
}
Post method:
public Result post(Http.Request request) {
Form<LoginForm> form = formFactory.form(LoginForm.class).bindFromRequest(request);
if (form.hasErrors()) {
return unauthorized(login.render(form));
}
String hashedPassword = FormHelper.hash(form.get().password);
User user = User.byUsernameAndHashedPassword(form.get().username, hashedPassword);
return redirect(routes.Main.overview()).addingToSession(request, TypeKeyHelper.USER_ID, user.id.toString());
}