AmerDwight opened a new issue, #10863:
URL: https://github.com/apache/apisix/issues/10863
### Description
I wonder if it's a foundamental knowledge that I shall have.
If there are docs, tutorials, or guide, please let me know.
I'm wondering if I set a route for upstream, which provides a web( html ) in
response.
And there is a sub link in that page, e.g. mainpage to a sub-page.
Then when I click it on blowserm it shall directs to ?
1. If that link uses a **absolute address** to sub-page --> Clients get 404
on blowser
2. If that link uses a **referal address** to sub page --> Clients get ? (
still 404 in my test)
I don't know if there is a way to solve situ.1
So I tried to build a sample tio testify the situ.2
Here are routes that I set in apisix
Upstream:nginx_web
Routes:
```Json
{
"uri": "/web/*",
"name": "Web",
"methods": [
"GET",
"POST"
],
"plugins": {
"proxy-rewrite": {
"regex_uri": [
"^/web/(.*)",
"/$1"
]
}
},
"upstream_id": "490103218550866940",
"status": 1
}
```
So if the client calls apisix/web/mainpage,
it directs to nginx_web/mainpage, which is fine.
but when I click in some link to another sub-page, it goes to:
apisix/subpage ( I use referal address ) --> and this cannot be identified
in apisix routing.
How do we solve that? and evenmore, how do we keep clients info to next page?
belows are samples, modified by apisix public case:
Upstream:nginx web server
```nginx.conf
worker_processes 1;
error_log stderr notice;
events {
worker_connections 1024;
}
http {
variables_hash_max_size 1024;
access_log /var/log/nginx/access.log;
real_ip_header X-Real-IP;
charset utf-8;
server {
listen 80;
# 定义服务器的根目录
root /usr/share/nginx/html;
# 默认页面
location / {
index sample2.html;
# return 200 "This is sample 2 from nginx web server 2 \n";
}
# sample1 页面
location /sample1 {
try_files $uri $uri/ /sample1.html;
}
# sample2 页面
location /sample2 {
try_files $uri $uri/ /sample2.html;
}
# 健康检查
location /health {
return 200 "OK";
}
access_log /var/log/nginx/domain1.access.log;
}
}
```
Page:
1.
```html
<!-- sample1.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sample 1</title>
</head>
<body>
<p>This is sample 1 from nginx web server.</p>
<a href="/sample2"><button>Go to Sample 2</button></a>
</body>
</html>
```
2.
```html
<!-- sample1.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sample 1</title>
</head>
<body>
<p>This is sample 1 from nginx web server.</p>
<a href="/sample1"><button>Go to Sample 1</button></a>
</body>
</html>
```
### Environment
- APISIX version (run `apisix version`):apache/apisix:3.6.0-centos
- Operating system (run `uname -a`):Docker
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
- etcd version, if relevant (run `curl
http://127.0.0.1:9090/v1/server_info`):bitnami/etcd:3.5
- APISIX Dashboard version, if relevant:3.0.1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]