Asp.Mvc core always sees requests as HTTP

35 views
Skip to first unread message

Marcelo Volmaro

unread,
Jul 25, 2018, 10:51:08 AM7/25/18
to Google App Engine
I just hosted an Asp.Mvc app in AppEngine (flex environment), and everything is going ok.

Now, I want my app to be served only over https. Right now, I can access it both from http and https.

The problem is that if I check the incoming request, it always shows as HTTP (even if the request comes from https). So, there is no way for me to detect and try to redirect (since a redirect will always produce an infinite redirection loop).

Is there any way I can set this outside my app? The documentation doesn't has any information on this.

Regards,

Attila-Mihaly Balazs

unread,
Jul 26, 2018, 12:15:57 AM7/26/18
to Google App Engine

"The X-Forwarded-Proto header lets you understand if the origin request was HTTP or HTTPs."

All the best,
Attila

Olu

unread,
Jul 26, 2018, 11:14:57 AM7/26/18
to Google App Engine
The documentation explains "By default, HTTPS connections on your custom domain will be enabled automatically using managed SSL certificates.". Managed certificates are provisioned on App Engine automatically once a Custom Domain is mapped to your application and the necessary DNS records are configured. Custom domains can be setup on App Engine on this section,  App Engine > Settings > Custom Domains

Please note that Custom Domains always require ownership verification

However, about being able to setup redirects based on the incoming request, unfortunately, App Engine Flex does not support the use of Secure handlers any longer. Hence, as recommended on this similar Stackoverflow case, the only way around with App Engine flex is to handle such redirects within your application. 

George (Cloud Platform Support)

unread,
Jul 27, 2018, 1:28:00 PM7/27/18
to Google App Engine
An interesting explanation with code sample is offered by Dan Cornilescu in his reply to the "Only receiving HTTP requests in Google App Engine Flex with .NET. How to only allow HTTPS?" question in stackoverflow. 
Reply all
Reply to author
Forward
0 new messages