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

CORS #118

Open
SilipTv5 opened this issue Oct 31, 2021 · 10 comments
Open

CORS #118

SilipTv5 opened this issue Oct 31, 2021 · 10 comments

Comments

@SilipTv5
Copy link

SilipTv5 commented Oct 31, 2021

Hi this is very basic question but i spent a lot of time but no success, im using nuster as a cache server and need to add CORS, below is my simplest config file

global
    nuster cache on dir /cache
    nuster manager on uri /internal/nuster purge-method PURGEX
frontend fe
    bind *:443 ssl crt /cert.pem alpn h2,http/1.1
    mode http
    default_backend be
backend be
    mode httpde
    nuster cache on
    nuster rule all disk on ttl 7d
    server s1 1.1.1.1:80

i tried to add CORS
http-response set-header Access-Control-Allow-Origin "yourhostname.com"
but no success
any idea plz?

@jiangwenyuan
Copy link
Owner

@SilipTv5

mode httpde

mode http I suppose

Did you put http-response set-header Access-Control-Allow-Origin "yourhostname.com" in the config?
It should response with this header, what do you mean no success? No Access-Control-Allow-Origin header?

@SilipTv5
Copy link
Author

SilipTv5 commented Nov 1, 2021

Thank you so much for a very quick response, so my config file should be look like this with CORS,

global
    nuster cache on dir /cache
    nuster manager on uri /internal/nuster purge-method PURGEX
frontend fe
    bind *:443 ssl crt /cert.pem alpn h2,http/1.1
    mode http
    default_backend be
backend be
    mode http
    http-response set-header Access-Control-Allow-Origin "yourhostname.com"
    nuster cache on
    nuster rule all disk on ttl 7d
    server s1 1.1.1.1:80

Right?

@jiangwenyuan
Copy link
Owner

Yes

@SilipTv5
Copy link
Author

SilipTv5 commented Dec 4, 2021

I thought with above config cache will save on nuster server for 7 days, but in reality it is not saving anything, its only playing video from backend server like a proxy server,
where im doing wrong? i want that nuster server save video in cache from first request and serve for next 7 days,
Thanks

@jiangwenyuan
Copy link
Owner

@SilipTv5 The config is OK. Do you have permission to write to /cache ? Can you enable log and upload the logs?

@SilipTv5
Copy link
Author

SilipTv5 commented Dec 21, 2021

if i want to use Nuster as a reverse proxy without using any cache, below config is ok?

global
nuster manager on uri /internal/nuster purge-method PURGEX
frontend fe
bind *:443 ssl crt /cert.pem alpn h2,http/1.1
mode http
default_backend be
backend be
mode http
server s1 1.1.1.1:80

@jiangwenyuan
Copy link
Owner

Yes

@SilipTv5
Copy link
Author

this is working and now facing SSL issue, any idea?

@packeteer
Copy link

sounds like standard ssl termination, so this should help:
https://www.haproxy.com/blog/haproxy-ssl-termination/

@SilipTv5
Copy link
Author

SilipTv5 commented Jan 4, 2022

global
    nuster cache on dir /cache
    nuster manager on uri /internal/nuster purge-method PURGEX
frontend fe
    bind *:443 ssl crt /cert.pem alpn h2,http/1.1
    mode http
    default_backend ssl_443
backend ssl_443
    mode http
    nuster cache off
    nuster rule all disk on ttl 7d
    server s1 00.00.00.00:443 ssl verify none

Finally this config work with SSL, but facing a minor issue, WordPress site health have this issue
The REST API call gave the following unexpected result: (520)
that is most probably is with SSL misconfiguration
Any Help?
Thanks

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

3 participants