Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base url to www redirection doesn't work #197

Open
felipexpert opened this issue Aug 18, 2019 · 0 comments
Open

base url to www redirection doesn't work #197

felipexpert opened this issue Aug 18, 2019 · 0 comments

Comments

@felipexpert
Copy link

felipexpert commented Aug 18, 2019

This is my keter.yml:

# exec: ../dist/build/Fastwork/Fastwork
# exec: ../dist/bin
# args:
#   - production
# host: 127.0.0.1
# After you've edited this file, remove the following line to allow
# `yesod keter` to build your bundle.
# user-edited: false

# A Keter app is composed of 1 or more stanzas. The main stanza will define our
# web application. See the Keter documentation for more information on
# available stanzas.
stanzas:

  # Your Yesod application.
  - type: webapp

    # Name of your executable. You are unlikely to need to change this.
    # Note that all file paths are relative to the keter.yml file.
    #
    # The path given is for Stack projects. If you're still using cabal, change
    # to
    # exec: ../dist/build/PROJECTNAME/PROJECTNAME
    exec: ../dist/bin/Fastwork

    # Command line options passed to your application.
    args: []

    hosts:
      # You can specify one or more hostnames for your application to respond
      # to. The primary hostname will be used for generating your application
      # root.
      - dinhonesto.com.br
      - www.dinhonesto.com.br

    # Enable to force Keter to redirect to https
    # Can be added to any stanza
    requires-secure: true

  # Static files.
  - type: static-files
    hosts:
      - upload.dinhonesto.com.br
    root: /opt/fastworkupload
    middleware:
      - headers:
          Access-Control-Allow-Origin : "*"
    # Uncomment to turn on directory listings.
    directory-listing: false

  # Redirect plain domain name to www.
  - type: redirect

    hosts:
      - dinhonesto.com.br
    actions:
      - host: www.dinhonesto.com.br

    # Uncomment to switch to a non-permanent redirect.
    # status: 303

# Use the following to automatically copy your bundle upon creation via `yesod
# keter`. Uses `scp` internally, so you can set it to a remote destination
# copy-to: user@host:/opt/keter/incoming/

# You can pass arguments to `scp` used above. This example limits bandwidth to
# 1024 Kbit/s and uses port 2222 instead of the default 22
# copy-to-args:
#   - "-l 1024"
#   - "-P 2222"

# If you would like to have Keter automatically create a PostgreSQL database
# and set appropriate environment variables for it to be discovered, uncomment
# the following line.
# plugins:
#   postgres: true

It doesn't redirect https://dinhonesto.com.br to https://www.dinhonesto.com.br (although http is redirecting to https all right)

this is my keter configuration on the server:

# Directory containing incoming folder, where to store logs, etc. Relative to
# the config file directory.
root: ..

# Keter can listen on multiple ports for incoming connections. These ports can
# have HTTPS either enabled or disabled.
listeners:
    #- host: "medital.com.br"
    #  actions:
    #      - host: "medital.com.br"
    #        port: 8080 # Could be used to modify port
    # HTTP
    - host: "*4" # Listen on all IPv4 hosts
      port: 80 # Could be used to modify port
    - host: "*4" # Listen on all IPv4 hosts
      port: 443 # Could be used to modify port
      key: /opt/keter/etc/cert/private.key
      certificate: /opt/keter/etc/cert/certificate.crt
    - host: "*4" # Listen on all IPv4 hosts
      port: 3000 # Could be used to modify port
    - host: "*4" # Listen on all IPv4 hosts
      port: 3001 # Could be used to modify port
      key: /opt/keter/etc/cert/private.key
      certificate: /opt/keter/etc/cert/certificate.crt
      #key: /opt/keter/etc/cert/dinhonesto.com.br.dec.key
      #certificate: /opt/keter/etc/cert/dinhonesto.com.br.crt
    # HTTPS
    #- host: "*4"
      #port: 443
      #key: key.pem
      #certificate: certificate.pem

redirects:
    - from: dinhonesto.com.br
      to: www.dinhonesto.com.br

# User to run applications as

# setuid: ubuntu

# Get the user's IP address from x-forwarded-for. Useful when sitting behind a
# load balancer like Amazon ELB.

# ip-from-header: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant