Git Product home page Git Product logo

s3www's Introduction

s3www

Serve static files from any S3 compatible object storage endpoints.

Simplifies and secure AWS S3 Static Website Hosting by keeping your bucket private, secure, run-anywhere you like and with Automatic TLS based on Let's Encrypt.

Features

  • Automatic credentials rotation when deployed on AWS EC2, ECS or EKS services for your AWS S3 buckets - yay! ๐Ÿ”’๐Ÿ˜
  • Automatic certs renewal for your DOMAIN along with OCSP stapling, full suite of ACME features, HTTP->HTTPS redirection (all thanks to certmagic).

Install

Released binaries are available here, or you can compile yourself from source.

NOTE: minimum Go version needed is v1.18

go install github.com/harshavardhana/s3www@latest

Binary

Make sure you have index.html under mysite

s3www -endpoint "https://s3.amazonaws.com" -accessKey "accessKey" \
	  -secretKey "secretKey" -bucket "mysite"

s3www: Started listening on http://127.0.0.1:8080

Point your web browser to http://127.0.0.1:8080 ensure your s3www is serving your index.html successfully.

Container

Make sure you have index.html under mysite

podman run --rm -p 8080:8080 y4m4/s3www:latest \
	  -endpoint "https://s3.amazonaws.com" \
	  -accessKey "accessKey" \
	  -secretKey "secretKey" \
	  -bucket "mysite" \
	  -address "0.0.0.0:8080"

s3www: Started listening on http://0.0.0.0:8080

Point your web browser to http://127.0.0.1:8080 ensure your s3www is serving your index.html successfully.

Auto TLS

Make sure you have index.html under mysite

s3www -endpoint "https://s3.amazonaws.com" -accessKey "accessKey" \
	  -secretKey "secretKey" -bucket "mysite" \
	  -lets-encrypt -address "example.com"

s3www: Started listening on https://example.com

Point your web browser to https://example.com ensure your s3www is serving your index.html successfully.

Permissions

AWS IAM Policy

s3www requires access to view and list all files in the bucket.

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "",
			"Effect": "Allow",
			"Action": "s3:GetObject",
			"Resource": "arn:aws:s3:::<Bucket Name>/*"
		},
		{
			"Sid": "",
			"Effect": "Allow",
			"Action": "s3:ListBucket",
			"Resource": "arn:aws:s3:::<Bucket Name>"
		}
	]
}

License

This project is distributed under the Apache License, Version 2.0, see LICENSE for more information.

s3www's People

Contributors

aleksandrzhiliaev avatar anbraten avatar cuotos avatar dependabot[bot] avatar djerfy avatar harshavardhana avatar ilyajob05 avatar lukashass avatar minhdanh avatar oliverisaac avatar sipioteo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

s3www's Issues

Support for IRSA

Hi,

we are right now trying to use s3www to access some html reports stored in s3 using this tool from a kubernetes (eks) cluster.
But sadly we noticed that s3www does not support IRSA right now which makes it impossible for us to access our s3 buckets from within our kubernetes clusters.

As the common aws lib is used here it should be easy to add IRSA into the authentication chain.

Thanks

Allow configuration by environment variables

when creating docker images its much nicer and easier to configure them via the environment variables instead of the command line.

It also makes it easier to see the existing configuration of the container.

Fixed file

Add the possibility to call always the same file whatever the url is.
It's useful to starting simple SAP software without getting mess with something like ngins.

Thank you!

404 Page

Is there a way to configure a 404 page?

Doesn't work with subfolder

I deployed s3www sucessfully. The website works on the root dir "/".
However it's returning 404 error when accessing a subdirectory like "/about/" (or "/about").
With "about" being a real directory with an index.html file on a s3 bucket.

Add flag to disable listing

While listing is definitely useful there may be situations one might want to disable it so that files are not easily exposed (hard-to-guess file names etc.).

404.html not working

I just tried the 404.html fix but it does not seem to work with docker version 0.8.0. I am a bit confused that the dockerhub container is older then the github release?

301 redirection on `/` and `index.html` that removes trailing slash breaks HTML relative paths

Hello,

$ http http://localhost:8080/index.html --print=hH
GET /index.html HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8080
User-Agent: HTTPie/0.9.8

HTTP/1.1 301 Moved Permanently
Content-Length: 0
Date: Thu, 10 Sep 2020 16:17:23 GMT
Location: ./

It's okay for the root folder since relative paths have a correct starting point but not for subfolder:

$ http http://localhost:8080/subfolder/ --print=hH
GET /subfolder/ HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8080
User-Agent: HTTPie/0.9.8

HTTP/1.1 301 Moved Permanently
Content-Length: 0
Date: Thu, 10 Sep 2020 16:17:34 GMT
Location: ../subfolder

Now index.html with a ./css/styles.css produces a http://localhost:8080/css/styles.css instead of http://localhost:8080/subfolder/css/styles.css.

Any other URL file paths but index.html are okay:

$ http http://localhost:8080/subfolder/test.html --print=hH
GET /subfolder/test.html HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8080
User-Agent: HTTPie/0.9.8

HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 12649
Content-Type: text/html; charset=utf-8
Date: Thu, 10 Sep 2020 16:22:54 GMT
Last-Modified: Thu, 10 Sep 2020 14:56:57 GMT

Is if fixable ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.