t2ym / thin-hook

Thin Hook Preprocessor
Other
4 stars 1 forks source link

[demo][Tips] Shortcut to run the demo without Service-Worker-Allowed header and HTTPS #56

Open t2ym opened 7 years ago

t2ym commented 7 years ago

Steps to run the demo without Service-Worker-Allowed header and HTTPS configuration

  1. Remove the preceding ../../thin-hook from the src of hook.min.js
    diff --git a/demo/index.html b/demo/index.html
    --- a/demo/index.html
    +++ b/demo/index.html
    @@ -15,7 +15,7 @@ Copyright (c) 2017, Tetsuya Mori <t2y3141592@gmail.com>. All rights reserved.
    <html lang="en">
    <head>
    <meta charset="utf-8">
    -  <script src="../../thin-hook/hook.min.js?version=425&no-hook-authorization=a89f6897bfdde93cb2b6c9e03e13f278e34b24ddde0174e72ac6d2ac9cdea4fd,log-no-hook-authorization&sw-root=/&no-hook=true&hook-name=__hoo
    +  <script src="/hook.min.js?version=425&no-hook-authorization=a89f6897bfdde93cb2b6c9e03e13f278e34b24ddde0174e72ac6d2ac9cdea4fd,56e5888cff0e85bde5dec7817a84c71fa5fb20f3fd15dc4ddd54d9307498944e,log-no-hook-au
    <script context-generator src="no-hook-authorization.js?no-hook=true"></script>
    <script context-generator src="hash-context-generator.js?no-hook=true"></script>
    <script context-generator no-hook>
  2. Run polyserve and access from the localhost
    polyserve

Notes:

t2ym commented 7 years ago

[ALTERNATIVE DEMO CONFIGURATION]

Configuration for nginx with HTTPS and Service-Worker-Allowed header

nginx.conf for HTTPS proxy to polyserve at port 8080

    # HTTPS server
    #
    server {
        listen       443 ssl;
        ... SSL configurations
        # Service-Worker-Allowed header
        add_header Service-Worker-Allowed /;
        ...
        # Proxy setting to polyserve at localhost:8080
        location /components/ {
            proxy_pass http://localhost:8080/components/;
        }
    }