Default home page / main page redirect #4

Open
opened 2 years ago by cel · 0 comments
cel commented 2 years ago
Owner

As mentioned in https://basement.woodbine.nyc/s/meeting-15_2022-12-28#basement-homepage and https://basement.woodbine.nyc/s/meeting-15_2023-01-04#INFRA

This might be a Woodbine-specific thing; but maybe it can be upstreamed/mainlined somehow.

Upstream hackerspace-zone redirects the default host ($DOMAIN_NAME)'s root path ("/") to Hedgedoc's Main_Page (250030fe7a/nginx/nginx/templates/000-default.conf.template (L54)).

Instead, we redirect it (https://woodbine.nyc/) to a www subdomain where we have a third-party-hosted site (https://www.woodbine.nyc/):

diff --git a/nginx/nginx/templates/000-default.conf.template b/nginx/nginx/templates/000-default.conf.template
index 293d02c..bcc166d 100644
--- a/nginx/nginx/templates/000-default.conf.template
+++ b/nginx/nginx/templates/000-default.conf.template
@@ -49,9 +49,8 @@ server {
                autoindex off;
        }

-       # default home page goes to hedgedoc document "Main_Page"; please add your own content!
        location = / {
-               return 302 https://${DOMAIN_NAME}/Main_Page;
+               return 302 https://www.${DOMAIN_NAME};
        }
        # rewrite /s/ links to the bare link
        location ~ ^/s/(.*) {

To still have a home page for the hackerspace on Hedgedoc, we now override the Hedgedoc home page ($HEDGEDOC_HOSTNAME "/" i.e. https://basement.woodbine.nyc/) to serve Main_Page (via a redirect):

diff --git a/nginx/nginx/templates/docs.conf.template b/nginx/nginx/templates/docs.conf.template
index 930ade8..6c29e20 100644
--- a/nginx/nginx/templates/docs.conf.template
+++ b/nginx/nginx/templates/docs.conf.template
@@ -27,6 +27,10 @@ server {
        # required to avoid HTTP 411: see Issue #1486 (https://github.com/dotcloud/docker/issues/1486)
        chunked_transfer_encoding on;

+       location = / {
+               return 302 /s/Main_Page;
+       }
+
        location / {
                proxy_pass http://host.docker.internal:3000;
                proxy_set_header Host $host;
As mentioned in https://basement.woodbine.nyc/s/meeting-15_2022-12-28#basement-homepage and https://basement.woodbine.nyc/s/meeting-15_2023-01-04#INFRA This might be a Woodbine-specific thing; but maybe it can be upstreamed/mainlined somehow. Upstream hackerspace-zone redirects the default host (`$DOMAIN_NAME`)'s root path ("/") to Hedgedoc's `Main_Page` (https://git.woodbine.nyc/cel/hackerspace-zone-mirror/src/commit/250030fe7a785d31077f8d239dae0aa438f98ec5/nginx/nginx/templates/000-default.conf.template#L54). Instead, we redirect it (https://woodbine.nyc/) to a `www` subdomain where we have a third-party-hosted site (https://www.woodbine.nyc/): ```diff diff --git a/nginx/nginx/templates/000-default.conf.template b/nginx/nginx/templates/000-default.conf.template index 293d02c..bcc166d 100644 --- a/nginx/nginx/templates/000-default.conf.template +++ b/nginx/nginx/templates/000-default.conf.template @@ -49,9 +49,8 @@ server { autoindex off; } - # default home page goes to hedgedoc document "Main_Page"; please add your own content! location = / { - return 302 https://${DOMAIN_NAME}/Main_Page; + return 302 https://www.${DOMAIN_NAME}; } # rewrite /s/ links to the bare link location ~ ^/s/(.*) { ``` To still have a home page for the hackerspace on Hedgedoc, we now override the Hedgedoc home page (`$HEDGEDOC_HOSTNAME` "/" i.e. https://basement.woodbine.nyc/) to serve `Main_Page` (via a redirect): ```diff diff --git a/nginx/nginx/templates/docs.conf.template b/nginx/nginx/templates/docs.conf.template index 930ade8..6c29e20 100644 --- a/nginx/nginx/templates/docs.conf.template +++ b/nginx/nginx/templates/docs.conf.template @@ -27,6 +27,10 @@ server { # required to avoid HTTP 411: see Issue #1486 (https://github.com/dotcloud/docker/issues/1486) chunked_transfer_encoding on; + location = / { + return 302 /s/Main_Page; + } + location / { proxy_pass http://host.docker.internal:3000; proxy_set_header Host $host; ```
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: cel/hackerspace-zone-mirror#4
Loading…
There is no content yet.