0

Silex を使用する場合、次のような単純なルートを定義します。

 $app->get('/hello', function() use ($app, $help){             
    $response = new Response( 
       json_encode( array("message"=>"hello") ), 400 
    );
    return $response; 
 });
  • と: curl -X GET -i -c cookies.txt http://mysite/web/hello
  • 私は得る:{"message":"hello"}

しかし

  • と:curl -X GET -k -i -c cookies.txt https://mysite/web/hello
  • 私は得る:HTTP/1.1 404 Not Found

リクエストのセキュリティ コンテキストに基づいて、http と https の両方に同じルートを定義するにはどうすればよいですか?

UPDATE1: 追加情報

Apache2 は次のように構成されます。

デフォルト

<VirtualHost *:80>
        ServerName   mysite

        DocumentRoot /var/www/mydev
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/mydev/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

デフォルト-ssl

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
        ServerName   mysite

        DocumentRoot /var/www/mydev
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/mydev/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ... Using default Apache2 configuration
        SSLEngine on


        #   A self-signed certificate can be ...
        SSLCertificateKeyFile /home/user1/ssl/server.key.insecure
...
</VirtualHost>
</IfModule>
4

0 に答える 0