Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Redirecting 80 to 443



On Wed, Jun 07, 2023 at 08:55:46AM +1200, Lloyd Parkes wrote:
> The httpd manual page describes how to invoke Lua scripts, but these
> aren't CGI scripts. The manual page also describes how to invoke CGI
> scripts of course.

I would try a special document root for the port 80 instance and
place (as only content) a .bzabsredirect symbolic link there.

Martin

--8<--

[/tmp] martin@big-apple > mkdir www-port-80
[/tmp] martin@big-apple > cd www-port-80/
[/tmp/www-port-80] martin@big-apple > ln -s "https://my.server.com/"; .bzabsredirect
[/tmp/www-port-80] martin@big-apple > ll -a
total 12
drwxr-xr-x   2 martin  wheel   24 Jun  7 08:06 ./
drwxrwxrwt  10 root    wheel  288 Jun  7 08:05 ../
lrwxr-xr-x   1 martin  wheel   22 Jun  7 08:06 .bzabsredirect@ -> https://my.server.com/
[/tmp/www-port-80] martin@big-apple > cd ..
[/tmp] martin@big-apple > /usr/libexec/httpd www-port-80/
get /
got request ``get /'' from host <local> to port <stdin>
redirecting https://my.server.com/
HTTP/0.9 301 Document Moved

<html><head><title>Document Moved</title></head>
<body><h1>Document Moved</h1>
This document had moved <a href="https://my.server.com/";>here</a>
</body></html>



Home | Main Index | Thread Index | Old Index