Home

Issue: 1494

How to get request header using nuxt

[issue link]

I am using nginx proxy to nuxt project, and I set real addr in nginx config, here is my config:

location / {
                   proxy_set_header X-Real-IP $remote_addr;
                   proxy_set_header X-User-Agent $http_user_agent;
                   proxy_set_header X-Referer $http_referer;
                   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                   proxy_set_header Host $http_host;
                   proxy_pass http://127.0.0.1:3000/;
                   proxy_redirect off;
},

I found when nuxt project axios a request to tomcat ,tomcat log get X-Real-IP is null,I think the problem is that the axios didn’t give the nginx header to tomcat,so I prepare to get nginx header in nuxt and set axios header so that tomcat can get X-Real-IP. So the problem is how to get request header using nuxt !
Any one can help ?

This question is available on Nuxt.js community (#c1330)