Caddy: vue history mode with caddy2 rewrite

Created on 21 Apr 2020  路  9Comments  路  Source: caddyserver/caddy

My static files handled by caddy and ajax request handled by tomcat. I use vue with history mode.
My Caddyfile is here:
`localhost:2019 {
encode gzip

header / {
Strict-Transport-Security "max-age=31536000;"
X-XSS-Protection "1; mode=block"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
}

header /static/js {
Content-Type "application/javascript; charset=utf-8"
}

header /static/css {
Content-Type "text/css; charset=utf-8"
}

header /api {
Access-Control-Allow-Origin *
Access-Control-Allow-Methods "GET, POST, DELETE, OPTIONS"
Content-Type "application/javascript"
}

handle * / {

route /api/* {
  uri strip_prefix api
  reverse_proxy http://xxx.xxx.xx.xxx:8097
}

}
// something wrong here
rewrite * /

root C:/mySoftware/caddy/site
file_server

log {
output file access.log
format single_field common_log
}
}
`

Whitout rewrite is fine. When i add it, my chrome page is bank and console prints: Resource interpreted as Stylesheet but transferred with MIME type text/html.
As u can see, I had add some headers, but it dose not work.
So please help me solve this problem.

question

Most helpful comment

I mean inconvenient. 馃槄

All 9 comments

https://caddy.community/ is blocked.

What do you mean?

When i add it, my chrome page is bank and console prints: Resource interpreted as Stylesheet but transferred with MIME type text/html.

Usually this is because the file has a non-standard extension or the system does not have a proper MIME Types table installed.

(Going to close this issue as it appears to be more of a question about how to use Caddy, rather than a bug in Caddy itself, but feel free to continue the discussion, at least until you can access the forum.)

https://caddy.community/ is blocked.

What do you mean?

I can't open it without a VPN. I will solve it.

Is your government blocking it? That'd be the first I've heard of it. Wonder if it's collateral damage from an overly aggressive blacklist.

Yes, it is very discommodiousness.

I had to look up that word

I mean inconvenient. 馃槄

Sorry about that. We'll try and look into possible solutions when we have a chance!

Until you can access the forums, feel free to continue discussion here as necessary until you get an answer to your question.

Sorry about that. We'll try and look into possible solutions when we have a chance!

Until you can access the forums, feel free to continue discussion here as necessary until you get an answer to your question.

OK.

Was this page helpful?
0 / 5 - 0 ratings