Rails Cloud9 public preview w/ elastic ip not working with https

0

Hi there!

I followed all steps available at https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html for sharing a Running Application over the Internet.
It worked well at port 8080.

It happens that my application has many interactions with Slack, that enforces the use of https.

After having configured the ACL and Security Group inbound rules to accept http and https ports (80,8080,8081,8082,443) I'm still unable to access it via https.

When using the preview url (ex: https://12a34567b8cd9012345ef67abcd890e1.vfs.cloud9.us-east-2.amazonaws.com/) it works in https, but this address is only reachable from my browser.

Also, port 80 maps to Apache, not rails.

And when I try to run rails s -p 80 or 443, I get this error:
Permission denied - bind(2) for "0.0.0.0" port 80 (Errno::EACCES)

How can I map the requests from all http/https ports for rails, as cloud9 used to do?

質問済み 5年前366ビュー
1回答
0

I've managed to solve with this apache2 conf. And buying a SSL certificate.

Yes, It's just a shame I had to buy a SSL certificate in order to receive api requests in my dev environment, just because AWS won't let the public address be accessed outside my browser :/

The whole Cloud9 migration for AWS was an awful experience.

001-cloud9.conf:

<VirtualHost *:80>
    
    ServerName domain.com 
    Redirect permanent / https://domain.com/ 
    
</VirtualHost>

<VirtualHost *:8080>
    
    ServerName domain.com 
    Redirect permanent / https://domain.com/ 
    
</VirtualHost>

<VirtualHost *:8081>
    
    ServerName domain.com
    Redirect permanent / https://domain.com/ 
    
</VirtualHost>

<VirtualHost *:8082>
    
    ServerName domain.com
    Redirect permanent / https://domain.com/ 
    
</VirtualHost>

<IfModule mod_ssl.c>
	<VirtualHost _default_:443>
        ServerName domain.com
        
        DocumentRoot /home/ubuntu/environment

        ProxyPreserveHost On
    
        ProxyPass / http://127.0.0.1:3000/
        ProxyPassReverse / http://127.0.0.1:3000/

		SSLEngine on
		SSLCertificateFile /etc/ssl/certs/cert.crt
		SSLCertificateKeyFile /etc/ssl/certs/cert.key
		SSLCertificateChainFile /etc/ssl/certs/cert.crt
		
		<FilesMatch "\.(cgi|shtml|phtml|php)$">
				SSLOptions +StdEnvVars
		</FilesMatch>
		<Directory /usr/lib/cgi-bin>
				SSLOptions +StdEnvVars
		</Directory>

		BrowserMatch "MSIE [2-6]" \
				nokeepalive ssl-unclean-shutdown \
				downgrade-1.0 force-response-1.0
		BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

	</VirtualHost>
</IfModule>
回答済み 5年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ