Hi
On 27/02/2018 11:18, Solène Rapenne wrote:
> Le 2018-02-27 07:58, Mischa Peters a écrit :
>>> On 27 Feb 2018, at 05:04, niya <niyalevi@gmail.com> wrote:
>>>
>>> hi
>>> using vmd in openbsd 6.2
>>> and following
>>> http://thecyberrecce.net/2017/01/15/secure-webservers-with-openbsd-6-0-setting-up-httpd-mariadb-and-php/
>>> i have setup openbsd running a webserver
>>> everything installed and the webserver works via port 80 and 443.
>>> i can access the webserver from a remote client by browsing to the
>>> ip of the host machine and redirecting to the vm address and port
>>> using pf.
>>> i tried to setup port 80 redirection to port 443 so that all all
>>> access is over HTTPS, when i use http://host ip, i am redirected to
>>> https://default/
>>> how do i get the webserver to redirect to the ip address of the host
>>> machine?
>>>
>>> my httpd.conf
>>>
>>> server "default" {
>>> listen on $ext_addr port 80 block return 301
>>> "https://$SERVER_NAME$REQUEST_URI"
>>> # listen on $ext_addr port 80
>>> listen on $ext_addr tls port 443
>>> tls {
>>> key "/etc/ssl/private/server.key"
>>> certificate "/etc/ssl/server.crt"
>>> }
>>> directory {
>>> index "index.php"
>>> }
>>> location "*.php" {
>>> fastcgi socket "/run/php-fpm.sock"
>>> }
>>>
>>>
>>> shadrock
>>
>> Hi,
>>
>> $SERVER_NAME uses the name you have specified at 'server "default"'
>> which is "default" in this case.
>>
>> Mischa
>
> Exactly, $HTTP_HOST should be used instead of $SERVER_NAME for what
> you want to do.
>
thanks for the replies , i have tried your suggestion
the line in httpd.conf now reads
listen on $ext_addr port 80 block return 301
"https://$HTTP_HOST$REQUEST_URI"
i now get the following in firefox
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this
address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept
cookies.
shadrock
No comments:
Post a Comment