hsuh
hsuh

Reputation: 61

Play! framework: HTTPS and HTTP at the same time

I added https.port to my application.conf to gain HTTPS support. The problem is one of my routes require to be accessible through HTTP because the client is not supporting HTTPS. Is it somehow possible to make this happen without having to disable HTTPS for the whole site.

Thanks.

Edit:

My route file is pretty standard and has not changed since I converted to HTTPS. The problem is when I want to connect to the HTTP port, my connection times out.

Upvotes: 4

Views: 3444

Answers (2)

uthomas
uthomas

Reputation: 754

I'm using 2.0.

In my case @routes.Application.authenticate().absoluteURL(secure = true) generates https prefixed url, thought it's not working since I didn't fully configure it yet.

In prod I'm planning to use reverse proxy anyways.

Upvotes: 0

John P
John P

Reputation: 1580

You just need to have both http.port and https.port in the application.conf file. For the links you want to be different from the normal site, use the @@ notation:

@@{Controller.action().secure()} => https://...

@@{Controller.action()} => http://

Upvotes: 7

Related Questions