Skip to content

Jekyll url is not applied to the View button #610

Open

Description

@melroy89

Description:

Pressing the View button in the admin panel the URL is pointing to http://localhost:4000. But I'm behind a reverse proxy called Nginx.

Tell us a bit about yourself:

  • Version of JekyllAdmin I'm using: 0.10.2
  • Version of Jekyll I'm using: 4.1.1
  • Version of NodeJS I'm using: v14.15.0
  • Operating System <e.g. OS X, Windows>: Linux!
  • Browser <e.g, Safari, Chrome>: Firefox!

Steps to reproduce:

  1. Setup Jekyll as normal
  2. Configure _config.yml file, and set url key to: url: "https://yourdomain.com" (baseurl is just "/")
  3. Configure Nginx to use yourdomain.com as server_name in Nginx with a location / section containing at least: proxy_pass http://localhost:4000;
  4. Go to admin panel: https://yourdomain.com/admin
  5. Press the View button
  6. Links goes to http://localhost:4000/jekyll/update/2020/11/19/welcome-to-jekyll.html, which will NOT work.

I expected the following:

I expect the View links to take the url settings into account. The link example above, should go to:

https://yourdomain.nl/jekyll/update/2020/11/19/welcome-to-jekyll.html

But got the following, instead:

http://localhost:4000/jekyll/update/2020/11/19/welcome-to-jekyll.html

I think it shouldn't be that hard to get this solved, I hope 👍🏽 ?

Regards,
Melroy van den Berg

Activity

  1. changed the title [-]Jekyll url is not applied in View button[/-] [+]Jekyll url is not applied to the View button[/+] on Nov 19, 2020
  2. i-a-n commented on Nov 25, 2020

    @i-a-n
    Contributor

    this has been brought up a few times I believe, and I have yet to see an official response. I was able to get this working on my personal fork, however I do not believe my method (hijacking the URLable library to look for a special Jekyll config param) is necessarily a good answer for this project.

    you can see my personal hack at this commit:

    lib/jekyll-admin/urlable.rb
        def scheme
          JekyllAdmin.site.config["static_scheme"] || "http"
        end
    
        def host
          JekyllAdmin.site.config["static_host"] || JekyllAdmin.site.config["host"].sub("127.0.0.1", "localhost")
        end
    
        def port
          JekyllAdmin.site.config["static_port"] || JekyllAdmin.site.config["port"]
        end

    ... then on my Jekyll install:

    _config.yml
    static_scheme: https
    static_host: [my domain name]
    static_port: "443"

    this got things working for me 👍

  3. melroy89 commented on Nov 26, 2020

    @melroy89
    Author

    Wow, indeed this should become a PR. This is indeed working as expected.

    For backwards compatibility change:

    JekyllAdmin.site.config["static_scheme"] || "http"

    To:

    JekyllAdmin.site.config["static_scheme"] || JekyllAdmin.site.config["scheme"] || "http"

    Thank you so much! Let's fix this once and forever people!

    Ps. Also in YML this is just fine: static_port: 443 (no additional quotes are needed)

  4. mertkahyaoglu commented on Nov 27, 2020

    @mertkahyaoglu
    Member

    @i-a-n Thanks for the suggested solution. @ashmaroli Would you approve this?

  5. ashmaroli commented on Nov 27, 2020

    @ashmaroli
    Member

    Would you approve this?

    I would approve a tested Pull Request that proposes use of JekyllAdmin.site.config["jekyll_admin"][key] instead.

  6. jekyllbot commented on Mar 13, 2021

    @jekyllbot

    This issue has been automatically marked as stale because it has not been commented on for at least two months.

    The resources of the Jekyll team are limited, and so we are asking for your help.

    If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

    If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

    This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

  7. melroy89 commented on Mar 23, 2021

    @melroy89
    Author

    I hope you get a reply so it can be merged.

  8. jekyllbot commented on May 23, 2021

    @jekyllbot

    This issue has been automatically marked as stale because it has not been commented on for at least two months.

    The resources of the Jekyll team are limited, and so we are asking for your help.

    If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

    If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

    This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

  9. derek-adair commented on Oct 28, 2022

    @derek-adair

    I would approve a tested Pull Request that proposes use of JekyllAdmin.site.config["jekyll_admin"][key] instead.

    Can you clarify this? I'm running jekyll-admin behind a reverse-proxy and would love to get this in there. I think you are suggesting we have a setting that... if present will override the jekyll host config? Seems reasonable to me.

  10. melroy89 commented on Oct 28, 2022

    @melroy89
    Author

    It's a two year old issue. But as stated in my first issue description the website url is not being when indeed behind a reverse proxy (nginx). Causing those links not to work since they are pointing to local host with custom port. Instead of the domain name.

  11. derek-adair commented on Oct 30, 2022

    @derek-adair

    No, i get your issue @Danger89... :) I would like this feature as well. My question for clarification was for @ashmaroli, as in what will it take to merge this pull request.

  12. melroy89 commented on Oct 30, 2022

    @melroy89
    Author

    Ow sorry my bad!

    @ashmaroli Your turn xD

  13. kajtielplu commented on Mar 26, 2026

    @kajtielplu

    still an issue. i modified urlable.rb and _config.yml according to @i-a-n and @melroy89's suggestions, but changed port in urlable.rb to the following, since i'm running jekyll behind an nginx reverse proxy that already handles ports for me:

    def port
      return
    end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions