nginx like this…
server {
listen 80;
server_name spa-site.com ;
location / {
proxy_set_header Host $host:$proxy_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($http_user_agent ~* "Baidu") {
proxy_pass http://seo.com;
}
root D:\myWork\pc-vue-web\dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass api.com;
}
}`
caddy,How to achieve it?呢
like this no way
spa-site.com:80 {
root D:\myWork\pc-vue-web\dist
gzip
log ../access.log
ext .html
proxy /api api.com
errors {
404 /index.html
}
rewrite / {
if {>User-agent} has Phone
to proxy seo.com
}
}
seo.com:80{
root D:\seo
gzip
log ../access.log
ext .html
}`