Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Surfer
  3. Allow redirecting common HTTP codes

Allow redirecting common HTTP codes

Scheduled Pinned Locked Moved Solved Surfer
9 Posts 4 Posters 797 Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • murgeroM Offline
    murgeroM Offline
    murgero
    App Dev
    wrote on last edited by
    #1

    I'd like to request that we allow certain HTTP codes to be redirected to certain files if they exist:

    Example:

    If 404 (file not found) and my little website has a 404.html, it should use that instead of the surfer default.

    --
    https://urgero.org
    ~ Professional Nerd. Freelance Programmer. ~

    robiR 1 Reply Last reply
    3
    • murgeroM murgero

      I'd like to request that we allow certain HTTP codes to be redirected to certain files if they exist:

      Example:

      If 404 (file not found) and my little website has a 404.html, it should use that instead of the surfer default.

      robiR Offline
      robiR Offline
      robi
      wrote on last edited by
      #2

      @murgero Can this be accomplished with a bit of JS in the page?

      Otherwise it may make sense to use something like caddy2 which has a host of other features and configuration options.

      Conscious tech

      1 Reply Last reply
      0
      • nebulonN Offline
        nebulonN Offline
        nebulon
        Staff
        wrote on last edited by
        #3

        Good idea. Do you think some convention is good enough? Like as you said if the document root contains a file of the name schema <statucode>.htm(l), surfer should deliver that?

        This would not require any further UI and settings.

        fbartelsF murgeroM 2 Replies Last reply
        1
        • nebulonN nebulon

          Good idea. Do you think some convention is good enough? Like as you said if the document root contains a file of the name schema <statucode>.htm(l), surfer should deliver that?

          This would not require any further UI and settings.

          fbartelsF Offline
          fbartelsF Offline
          fbartels
          App Dev
          wrote on last edited by
          #4

          @nebulon yes that would be a good approach, as it would immediately be compatible with some static site builders such as Hugo.

          1 Reply Last reply
          1
          • nebulonN nebulon

            Good idea. Do you think some convention is good enough? Like as you said if the document root contains a file of the name schema <statucode>.htm(l), surfer should deliver that?

            This would not require any further UI and settings.

            murgeroM Offline
            murgeroM Offline
            murgero
            App Dev
            wrote on last edited by murgero
            #5

            @nebulon Yes I like that approach. Or maybe a settings page that has the ability for admins to specify a file for each status code. They can give the status code they want to redirect for and the file to redirect to.
            Certain status codes should be ignored however: Specifically:

            • 100
            • 101
            • 102
            • 103
            • 200
            • 201
            • 202
            • 203
            • 205
            • 206
            • 207
            • 208
            • 226

            @robi

            Can this be accomplished with a bit of JS in the page?

            No as what I am asking for happens before a page is loaded, not after.

            --
            https://urgero.org
            ~ Professional Nerd. Freelance Programmer. ~

            1 Reply Last reply
            1
            • nebulonN Offline
              nebulonN Offline
              nebulon
              Staff
              wrote on last edited by
              #6

              For a start this really only applies to 404.html as far as I can tell.

              murgeroM 1 Reply Last reply
              1
              • nebulonN nebulon

                For a start this really only applies to 404.html as far as I can tell.

                murgeroM Offline
                murgeroM Offline
                murgero
                App Dev
                wrote on last edited by
                #7

                @nebulon I would do Status codes 4XX to cover most client-side status codes to start

                --
                https://urgero.org
                ~ Professional Nerd. Freelance Programmer. ~

                1 Reply Last reply
                1
                • nebulonN Offline
                  nebulonN Offline
                  nebulon
                  Staff
                  wrote on last edited by
                  #8

                  This is now fixed with version 5.15.0

                  I only added support for 404 pages for now, since this is the only 4* error code the app would publicly serve up anyways.

                  murgeroM 1 Reply Last reply
                  4
                  • nebulonN nebulon

                    This is now fixed with version 5.15.0

                    I only added support for 404 pages for now, since this is the only 4* error code the app would publicly serve up anyways.

                    murgeroM Offline
                    murgeroM Offline
                    murgero
                    App Dev
                    wrote on last edited by
                    #9

                    @nebulon I can confirm the update works very well - Thank you!

                    --
                    https://urgero.org
                    ~ Professional Nerd. Freelance Programmer. ~

                    1 Reply Last reply
                    1
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Bookmarks
                    • Search